I have an array with unknown information. I want to get each element and assign it to a variable so I can use it elsewhere.
This works but it only gets the first element.
function firstElement($foo,$m='k') {
foreach ($foo as $k=>$v){
return $$m;
}
}
$firstKey=firstElement($foo);
$firstVal=firstElement($foo,'v');
extract()built-in function insteadextract(), though if they are in an array, perhaps they are related and belong in an array?