-
- 20 PHP Programs
- Sum of Digits
- Even Odd
- Prime Number
- Table of Number
- Factorial
- Armstrong Number
- Palindrome Number
- Fibonacci Series
- Reverse Number
- Reverse String
- Swapping Two Numbers
- Adding Two Numbers
- Subtracting Two Numbers
- Area of a Triangle
- Area of Rectangle
- Leap Year
- Alphabet Triangle Method
- Alphabet Triangle
- Number Triangle
- Star Triangle
-
- PHP Array
- PHP Indexed Array
- PHP Associative Array
- Multidimensional Array
- PHP Array Functions
- PHP array_arsort() Function
- PHP Array asort() Function
- PHP Array changekeycase() Function
- PHP Array Chunk() Function
- PHP Array column() Function
- PHP Array combine() Function
- PHP Array compact() Function
- PHP Array count() Function
- PHP Array count_values() Function
- PHP Array current() Function
- PHP array_diff_assoc() Function
- PHP array_diff() Function
- PHP array_diff_key() Function
- PHP array_diff_uassoc() Function
- PHP array_diff_ukey() Function
- PHP array each() Function
- PHP array end() Function
- PHP array extract() Function
- PHP array_fill() Function
- PHP array_fill_keys() Function
- PHP array_filter() Function
- PHP array flip() Function
- PHP in_array() Function
- PHP array_intersect_assoc() Function
- PHP array_intersect() Function
- PHP array_intersect_key() Function
- PHP array_intersect_uassoc() Function
- PHP array_intersect_ukey() Function
- PHP array_key_exists() Function
- PHP array_key_first() Function
- PHP array_key() Function
PHP Multidimensional Array
PHP multidimensional array is also known as array of arrays. It allows you to store tabular data in an array. PHP multidimensional array can be represented in the form of matrix which is represented by row * column.
Definition
$emp = array
(
array(1,"sonoo",400000),
array(2,"john",500000),
array(3,"rahul",300000)
);
PHP Multidimensional Array Example
Let's see a simple example of PHP multidimensional array to display following tabular data. In this example, we are displaying 3 rows and 3 columns.
Id | Name | Salary |
---|---|---|
1 | sonoo | 400000 |
2 | John | 500000 |
3 | rahul | 300000 |
File: multiarray.php
PHP Example
<?php
$emp = array
(
array(1,"sonoo",400000),
array(2,"john",500000),
array(3,"rahul",300000)
);
for ($row = 0; $row < 3; $row++) {
for ($col = 0; $col < 3; $col++) {
echo $emp[$row][$col]." ";
}
echo "<br/>";
}
?>
Output
1 sonoo 400000
2 john 500000
3 rahul 300000
← Previous Topic
PHP Associative Array
PHP Array Functions
Next Topic →