Creating a Multidimensional Array
<?php
$myarray = array('mykey'=> 'myvalue','key2'=> array(1, 2, 3, 4));
$sub_array[] = 1;
$sub_array[] = 2;
$sub_array[] = 3;
$sub_array[] = 4;
$example['mykey'] = 'myvalue';
$example['key2'] = $sub_array;
$anotherarray['mykey'] = 'myvalue';
$anotherarray['key2'][] = 1;
$anotherarray['key2'][] = 2;
$anotherarray['key2'][] = 3;
$anotherarray['key2'][] = 4;
?>
Related examples in the same category