<?php function myfunction($value,$key) { echo "The key $key has the value $value<br>"; } $array=array(array('red','green'),'blue','yellow'); array_walk_recursive($array,'myfunction'); ?>