首页 > 代码库 > php遍历数组赋值

php遍历数组赋值

<?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遍历数组赋值