PHP Multidimensional Array

PHP Multidimensional Array is an arrays  containing one or more arrays.

PHP multidimensional arrays can be any level deep. However, arrays more than three levels deep are hard to manage .

In other words a multidimentional array is the collection of arrays . which can be manages with  indices to select an element.
2D array needs 2 indices to select an element,3D array you needs 3 indices to select an element, as the level increases the number of indices also increases.

For Example : If you want to store Employee information eg name , age , employee id than it can be stored in an array which is collection of array of employee detail.

$empinfo= array

To retrive data from array of B we use to


echo $empinfo[1][0].": name: ".$empinfo[1][1].", sold: ".$empinfo[1][2].".<br>";



$empinfo is a variable which is having array datatype

One thought on “PHP Multidimensional Array

Comments are closed.