array_walk example

bool array_walk ( array &$array , callback $funcname [, mixed $userdata ] )


/* example !!
* transform array with other arrays as elements into an array with simple elements
* array trasform !
*/

$ar = array( array(1,2), array(10,20), array(100,200) );
function
sum(&$ar) //NOTE: Argument By reference
{
$ar = $ar[0]+$ar[1];
}

array_walk($ar, “sum”);
print_r($ar);
/*

Array
(
[0] => 3
[1] => 30
[2] => 300
)
*/