PHP References, Functions and Arrays
<?php $array = [[‘Example’ => ‘Value’]]; function hello(&$array) { foreach ($array as &$member) { $member[‘Test’] = true; } } var_dump($array); Consider the above. Why is it that ‘Test’ => true is not added to the array member [‘Example’ => ‘Value’]? I’ve passed references down the line, so $member should be a name referring to the […]
PHP: cant pass an object into a function, it becomes a string
I’m trying to pass an object to a function in PHP to split a long function. The first example is the working way with the long funcion: