hi guys...
so im reading this book to prep for the php test... and i come across this... (now i do warn you that im a newbie...and this maybe totally elementary.. .but... i need to know and i tried looking it up...but cant find answers)
Passive Iteration
The array_walk() function and its recursive cousin array_walk_recursive() can be
used to perform an iteration of an array in which a user-defined function is called.
Here’s an example:
function setCase(&$value, &$key)
{
$value = strtoupper($value);
}
$type = array(’internal’, ’custom’);
$output_formats[] = array(’rss’, ’html’, ’xml’);
$output_formats[] = array(’csv’, ’json’);
$map = array_combine($type, $output_formats);
array_walk_recursive($map, ’setCase’);
var_dump($map);
Using the custom setCase() function, a simplewrapper for strtoupper(), we are able to convert each each of the array’s values to uppercase. One thing to note about array_walk_recursive() is that it will not call the user-defined function on anything but scalar values; because of this, the first set of keys, internal and custom, are never passed in.
now... what gets me is this whole.... "because of this, the first set of keys, internal and custom, are never passed in"
as far as i can tell ...from what ive been reading.... the way those two arrays are declared and given values... they are essentially the same...
from what ive been reading... creating arrays with the array construct and the [] operators do the same thing...
why is this book telling me that the first array's values, 'internal' and 'custom' are not scalar (or for that matter...why is it telling me that the first array is different from the second array)... i feel they are just as scalar as the other arrays values (all varchars)... can anybody tell me what im not understanding here?