Multidimensional Array in PHP | Definition | Syntax | Examples

Hello Friend how are you i hope you all are doing well. Today in this post we will learn about Multidimensional Array in PHP like what is Multidimensional Array, Syntax of  Multidimensional Array, Initialization of Multidimensional Array with examples. If you want to learn PHP in very simple easy way then this post will help you definitely.

Multidimensional Array in PHP

1.The array inside array is called multidimensional array.
2.When an array contains one or more array then it is called Multidimensional array.
3.array() function is used to create array in PHP.

Multidimensional array using indexed array:

  echo $matrix[$i][$j]." ";
  echo "<br>";
80 50 20 
70 40 10 
90 60 30 

Multidimensional array using associative array

	   "branch"=>"Computer science"
	   "branch"=>"Information technology"
	   "branch"=>"Civil Engineering"
/* Printing Rocky information */ 
echo $student['Rocky']['rollno']."<br>";
echo $student['Rocky']['branch']."<br>";
/* Printing Tony information */ 
echo $student['Tony']['rollno']."<br>";
echo $student['Tony']['branch']."<br>";
Computer science
Civil Engineering

Types of Array in PHP 

There are three types of Array in PHP
1.Indexed Array Click here to learn.
2.Associative Array Click here to learn.
3.Multi Dimension Array Click here to learn.

Request:-If you found this post helpful then let me know by your comment and share it with your friend. 

If you want to ask a question or want to suggest then type your question or suggestion in comment box so that we could do something new for you all. 

If you have not subscribed my website then please subscribe my website. Try to learn something new and teach something new to other. 


Post a Comment