php小技巧
1.数组使用"+="
$get = array();
$get += array('a' => 'index');
$get += array('b' => 'index');
var_dump($get);
array(2) {
["a"]=>string(5) "index"
["b"]=>string(5) "index"
}
2.使用"&"符号
$array = ['a'=>'a','b'=>'b'];
foreach($array as &val){
if(val == 'b'){
val = 'c';
}
}
var_dump($array);
array(2) {
["a"]=>string(1) "a"
["b"]=>string(1) "c"
}