object - php pass array to function as separate variables -
i need know how pass array function separate variables, instance,
function myfunction($var, $othervar) { } $myarray = array('key'=>'val', 'data'=>'pair');
here running problems, following doesn't seem work:
$return = myfunction(extract($myarray));
it should, if understand correctly, same as
$return = myfunction($key, $data);
where $key='val' , $data='pair'
can please explain me.
if understanding question right try this
$return = myfunction($myarray["key"],$myarray["data"]);
here passing associative array arguments.
Comments
Post a Comment