note 43841 deleted from function.array-walk-recursive by betz

From: Date: Tue, 06 Jul 2004 06:42:37 +0000
Subject: note 43841 deleted from function.array-walk-recursive by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72712@lists.php.net to get a copy of this message
Note Submitter: viper_sb@whydoesnthisworkyahoo.com ---- This function doesn't work as I expected it to. It WILL go though ALL members of an array, but it WON'T return the key of an array member for example. <?php function test($value, $key) { print $key.'--'.$value."<br>\n"; } $array = array( 'key1' => 'value1', 'value2', 'key3' => array( 'subkey1' => 'subvalue1' ) ); array_walk_recursive($array, 'test'); ?> prints out key1--value1 0--value2 subkey1--subvalue1 You will NOT be able to get key3 from within the callback function. Also something else I might as well mention, if output buffering is on you get weird results i.e. sometimes it'll output the values and other times it won't. This could just be something specific to my system but maybe not.

« previous php.notes (#72712) next »