1. 程式人生 > >php遍歷數組賦值

php遍歷數組賦值

php pre 遍歷 each val core light int amp

<?php
$arr=array( 
             array("num"=>100,"name"=>"Liuxy","score"=>"hello")
           );

foreach ($arr as $key =>&$value) {
    if($value[‘name‘]=="Liuxy"){
        $value[‘name‘]=$value[‘score‘];
    }
}
print_r($arr);
?> 

php遍歷數組賦值