how to initialize a PHP bidimensional array -
let's manage multidimensional array (pseudo-code):
array $colors * wine,red * cheese,yellow * apple, green * pear,brown
what code used avoid following notation, initialize array (assuming there hard-coded list of elements=?:
$colors[x][y] = 'something';
$array = array( array('wine', 'red'), array('cheese', 'yellow'), array('apple', 'green'), array('pear', 'brown') );
upd:
foreach ($array $v) { echo $v[0]; // wine, cheese... echo $v[1]; // red, yellow... }
Comments
Post a Comment