+ 1

two dimensional array

how to print all the values of array? situation: echo $people_info['hello'][0][1][2]; output: (IT SHOWS AN ERROR) any solution?

24th Feb 2017, 7:45 AM
Rishu Mahaseth
Rishu Mahaseth - avatar
1 Réponse
0
Your title says two dimensional array, but your echo $people_info['hello'][0][1][2]; indicates a 4 dimensional array. Two dimensional array: $cars = array ( array("Volvo",22,18), array("BMW",15,13), array("Saab",5,2), array("Land Rover",17,15) ); OR PHP 5 $cars = [ ["Volvo", 22, 18], ["BMW", 15, 13], ["Saab", 5, 2], ["Land Rover", 17, 15] ]; To access "Saab": $cars[2][0]; To access 13: $cars[1][2];
24th Feb 2017, 8:03 AM
ChaoticDawg
ChaoticDawg - avatar