--> you can use &
ex)
function addSomeValueIntoArray(&$targetArray, $value)
2. Order of array_push when using nested array
ex)
<BAD>
$parentArray = array();
$childArray = ["foo" => bar];
array_push($parentArray, $childArray);
//Not reflected in parentArray
array_push($childArray, ["hello" => "world"]);
<Correct>
$parentArray = array();
$childArray = ["foo" => bar];
array_push($childArray, ["hello" => "world"]);
array_push($parentArray, $childArray);
No comments:
Post a Comment