Có bao nhiêu loại mảng trong PHP 1 điểm 1 2 3 4?

Mảng trong PHP là một kiểu cấu trúc dữ liệu cho phép chúng ta lưu trữ nhiều phần tử có kiểu dữ liệu giống nhau dưới một biến duy nhất, do đó tiết kiệm công sức tạo một biến khác cho mỗi dữ liệu. Các mảng rất hữu ích để tạo danh sách các phần tử có kiểu tương tự, có thể được truy cập bằng chỉ mục hoặc khóa của chúng. Giả sử chúng tôi muốn lưu trữ năm tên và in chúng theo đó. Điều này có thể dễ dàng thực hiện bằng cách sử dụng năm biến chuỗi khác nhau. Nhưng nếu thay vì năm, con số tăng lên hàng trăm, thì người dùng hoặc nhà phát triển sẽ thực sự khó tạo ra nhiều biến khác nhau như vậy. Ở đây, mảng phát huy tác dụng và giúp chúng ta lưu trữ mọi phần tử trong một biến duy nhất và cũng cho phép truy cập dễ dàng bằng chỉ mục hoặc khóa. Mảng được tạo bằng hàm array() trong PHP

Về cơ bản có ba loại mảng trong PHP.  

  • Mảng được lập chỉ mục hoặc số. Một mảng có chỉ mục số trong đó các giá trị được lưu trữ tuyến tính
  • Mảng kết hợp. Một mảng có chỉ mục chuỗi trong đó thay vì lưu trữ tuyến tính, mỗi giá trị có thể được gán một khóa cụ thể
  • Mảng đa chiều. Một mảng chứa một hoặc nhiều mảng bên trong nó và có thể được truy cập thông qua nhiều chỉ mục

Mảng được lập chỉ mục hoặc số

Các loại mảng này có thể được sử dụng để lưu trữ bất kỳ loại phần tử nào, nhưng chỉ mục luôn là một số. Theo mặc định, chỉ mục bắt đầu từ số không. Các mảng này có thể được tạo theo hai cách khác nhau như trong ví dụ sau.  

PHP




 

// One way to create an indexed array

$name_one =___

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0_______0_______1
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
4
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
6
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
8
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Accessing the elements directly:
zara
sara
any
Rani
Ravina
0
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

 

Accessing the elements directly:
zara
sara
any
Rani
Ravina
2

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Accessing the elements directly:
zara
sara
any
Rani
Ravina
4
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3 $name_one10_______8
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3 $name_one
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
3
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3 $name_one
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
8
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

 

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
1

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
4
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
7
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
8
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
1
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
2
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
5
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
6
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
90
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

 

Accessing the elements directly:
zara
sara
any
Rani
Ravina
2

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3 4
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Accessing the elements directly:
zara
sara
any
Rani
Ravina
8
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
3
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9_______10_______5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
8
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9_______10_______5

 

$name_one1

đầu ra.  

Accessing the 1st array elements directly:
Ram
Zack
Raghav
Accessing the 2nd array elements directly:
RAM
ZACK
RAGHAV

đi ngang qua. Chúng ta có thể duyệt qua một mảng được lập chỉ mục bằng cách sử dụng các vòng lặp trong PHP. Chúng ta có thể lặp qua mảng được lập chỉ mục theo hai cách. Đầu tiên bằng cách sử dụng vòng lặp for và thứ hai bằng cách sử dụng foreach. Bạn có thể tham khảo PHP. Vòng lặp cho cú pháp và sử dụng cơ bản.  

Ví dụ.   

PHP




 

$name_one3

$name_one =___

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0_______0_______1
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
4
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
6
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
8
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Accessing the elements directly:
zara
sara
any
Rani
Ravina
0
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

 

=8

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
00_______10_______5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
02
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1$name_one
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
05
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
06
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
07

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
06
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
14

 

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
15

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
16

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
17 =
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
19
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1$name_one
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
24
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

 

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
26

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
28
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
30_______0_______1
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
32
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
33_______0_______32
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
35
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
17
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
32
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
39

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Accessing the elements directly:
zara
sara
any
Rani
Ravina
3 $name_one___
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
32
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
45
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
14

 

$name_one1

đầu ra.  

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV

Mảng kết hợp

Các loại mảng này tương tự như các mảng được lập chỉ mục nhưng thay vì lưu trữ tuyến tính, mọi giá trị có thể được gán bằng khóa do người dùng xác định thuộc loại chuỗi.  

Ví dụ.   

PHP




 

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
51

$name_one =___

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0_______0_______1
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
58
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
4
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
62
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
64
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
6
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
67
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
8
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
71
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
64
Accessing the elements directly:
zara
sara
any
Rani
Ravina
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
76
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

 

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
78

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
81
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
82
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
83
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
87
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
82
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
89
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
93
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
82
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
95
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
99
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
82
Accessing the elements directly:
zara
sara
any
Rani
Ravina
01
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Accessing the elements directly:
zara
sara
any
Rani
Ravina
05
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
82
Accessing the elements directly:
zara
sara
any
Rani
Ravina
07
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

 

Accessing the elements directly:
zara
sara
any
Rani
Ravina
2

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Accessing the elements directly:
zara
sara
any
Rani
Ravina
11
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
81_______0_______45
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
99
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
45
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
87
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
45
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3 $name_one___
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43_______0_______6
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
45
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3 $name_one___
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Accessing the elements directly:
zara
sara
any
Rani
Ravina
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
45
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

 

$name_one1

đầu ra.  

Accessing the elements directly:
zara
sara
any
Rani
Ravina

Đi qua các mảng kết hợp. Chúng ta có thể duyệt qua các mảng kết hợp theo cách tương tự đã làm trong các mảng số bằng cách sử dụng các vòng lặp. Chúng ta có thể lặp qua mảng kết hợp theo hai cách. Đầu tiên bằng cách sử dụng vòng lặp for và thứ hai bằng cách sử dụng foreach. Bạn có thể tham khảo PHP. Vòng lặp cho cú pháp và sử dụng cơ bản.  

Ví dụ.   

PHP




 

Accessing the elements directly:
zara
sara
any
Rani
Ravina
50

$name_one =___

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0_______0_______1
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
58
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
4
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
62
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Accessing the elements directly:
zara
sara
any
Rani
Ravina
63
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
6
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
67
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
8
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
71
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Accessing the elements directly:
zara
sara
any
Rani
Ravina
63
Accessing the elements directly:
zara
sara
any
Rani
Ravina
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
76
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

 

Accessing the elements directly:
zara
sara
any
Rani
Ravina
77

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
00_______10_______5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
02
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1$name_one
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
05
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
06
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Accessing the elements directly:
zara
sara
any
Rani
Ravina
87
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
07

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Accessing the elements directly:
zara
sara
any
Rani
Ravina
91
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11_______0_______06
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11
Accessing the elements directly:
zara
sara
any
Rani
Ravina
95
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11
Accessing the elements directly:
zara
sara
any
Rani
Ravina
87
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
14

 

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
02

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
04
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
06 =
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
08_______0_______1
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
17 =___
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
19
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

 

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
30_______0_______1
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
20
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
21
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
20
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
35
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
17
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
25
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
20
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
27

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
06
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43_______21_______20
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
33
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
34
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
2
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
06
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
20
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
41
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9_______10_______5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
14

 

$name_one1

đầu ra.  

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina

Mảng đa chiều

Mảng nhiều chiều là những mảng lưu trữ một mảng khác tại mỗi chỉ mục thay vì một phần tử. Nói cách khác, chúng ta có thể định nghĩa mảng nhiều chiều là một mảng của các mảng. Như tên gợi ý, mọi phần tử trong mảng này có thể là một mảng và chúng cũng có thể chứa các mảng con khác bên trong. Mảng hoặc mảng con trong mảng đa chiều có thể được truy cập bằng nhiều chiều.  

Ví dụ.   

PHP




 

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
47

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
48 =___
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
56
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
58
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
61
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
63
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
66
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
68
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
71

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
56
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
78
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
61
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
83
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
66
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
88
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
71

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
56
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
98
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
61
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
03
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
66
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
08
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
11

Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

 

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
13

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
15
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
48_______28_______18
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
66
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
45
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
24
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11_______21_______48
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
27
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
61
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
29

 

$name_one1

đầu ra.  

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536

Di chuyển mảng đa chiều. Chúng ta có thể duyệt qua mảng nhiều chiều bằng cách sử dụng vòng lặp for và foreach theo cách lồng nhau. Tức là, một vòng lặp for cho mảng bên ngoài và một vòng lặp for cho mảng bên trong

Ví dụ.   

PHP




Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
47

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
48 =___
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
58
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
61
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
63
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
66
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
68
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
71

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
58
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
61
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
83
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
66
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
88
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
71

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
98
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
0_______0_______1

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
61
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
03
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
66
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
08
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
3

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
11

Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

 

Dave Punk email-id is: [email protected]
John Flinch mobile number is: 9875147536
89

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
06 =
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
08
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
48
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
30_______0_______1
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
20
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
33_______21_______20
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
35
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
19
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
48
Accessing the elements directly:
zara
sara
any
Rani
Ravina
1
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
20
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
07

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
06
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43_______21_______20
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
33
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
02
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
1
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
48
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
06
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
43
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
20
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
24
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
05
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
26
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
57
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
28
Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
27

Looping using foreach: 
Husband is Zack and Wife is Zara
Husband is Anthony and Wife is Any
Husband is Ram and Wife is Rani
Husband is Salim and Wife is Sara
Husband is Raghav and Wife is Ravina

Looping using for: 
zack zara
anthony any
ram rani
salim sara
raghav ravina
55
Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
26
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11_______38_______34
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11
Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]
28
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
11_______10_______9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
14

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
08
Accessing the elements directly:
zara
sara
any
Rani
Ravina
3
Accessing the elements directly:
zara
sara
any
Rani
Ravina
9
Accessing the elements directly:
zara
sara
any
Rani
Ravina
5

Looping using foreach: 
Zack
Anthony
Ram
Salim
Raghav

The number of elements is 5 
Looping using for: 
ZACK
ANTHONY
RAM
SALIM
RAGHAV
14

 

$name_one1

đầu ra.  

Dave Punk
mob : 2584369721
email : [email protected]

John Flinch
mob : 9875147536
email : [email protected]

Bài viết này được đóng góp bởi Chinmoy Lenka. Nếu bạn thích GeeksforGeeks và muốn đóng góp, bạn cũng có thể viết một bài báo bằng cách sử dụng write. chuyên viên máy tính. org hoặc gửi bài viết của bạn tới review-team@geeksforgeeks. tổ chức. Xem bài viết của bạn xuất hiện trên trang chính của GeeksforGeeks và trợ giúp các Geeks khác
Vui lòng viết bình luận nếu bạn thấy bất cứ điều gì không chính xác hoặc bạn muốn chia sẻ thêm thông tin về chủ đề thảo luận ở trên
 

PHP là ngôn ngữ kịch bản phía máy chủ được thiết kế dành riêng cho phát triển web. Bạn có thể học PHP từ đầu bằng cách làm theo Hướng dẫn PHP và Ví dụ về PHP này

3 loại mảng là gì?

Mảng nhiều chiều .
Mảng hai chiều
Mảng ba chiều

Có bao nhiêu kiểu mảng?

Có ba loại mảng khác nhau. mảng được lập chỉ mục, mảng nhiều chiều và mảng kết hợp

Mảng trong PHP là gì?

Mảng là một biến đặc biệt mà chúng ta sử dụng để lưu trữ hoặc giữ nhiều hơn một giá trị trong một biến mà không phải tạo thêm biến để lưu trữ các giá trị đó. To create an array in PHP, we use the array function array( ) . By default, an array of any variable starts with the 0 index.

Có bao nhiêu loại mảng trong PHP Mcq?

Trả lời. B) Có tổng cộng 3 loại mảng trong PHP.