我想建立一個循環多維數組和我難倒,爲什麼這個代碼不工作PHP多維數組構建
<?php
$users = array(35,25,45,34,56,67);
$months = array('smelly','stinky','chubby','grubby','nubby','funky');
foreach($users as $user){
$mdata[$user] = array();
foreach($months as $month){
array_push($mdata[$user][],$month);
}
}
print_r($mdata);
?>
你的岩石紀堯姆!謝謝! –