I am trying to build a function for easier array manipulation in my project.
I want to do it by passing reference. Hoping to be more productive and resource-saving way.
function add_element ($element=array(),&$data) {
if(!empty($data)) {
$data += $element;
}
return true;
}
// $element can be array('one','two') or array('color'=>'blue','type'=>'card')
I am not experienced with references, thanks for any tip.