> Instead of passing "this" and "other" to your array, PHP
> passes "0" and "other". Is there any way I can make it
> so that it passes "this"?
[pulled from the manual directly]
Example 1. array_walk() example
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
function test_alter (&$item1, $key, $prefix) {
$item1 = "$prefix: $item1";
}
function test_print ($item2, $key) {
echo "$key. $item2<br>\n";
}
echo "Before ...:\n";
array_walk ($fruits, 'test_print');
reset ($fruits);
array_walk ($fruits, 'test_alter', 'fruit');
echo "... and after:\n";
reset ($fruits);
array_walk ($fruits, 'test_print');
The printout of the program above will be:
Before ...:
d. lemon
a. orange
b. banana
c. apple
.... and after:
d. fruit: lemon
a. fruit: orange
b. fruit: banana
c. fruit: apple
--
Dan Hardiker [[EMAIL PROTECTED]]
ADAM Software & Systems Engineer
First Creative Ltd
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php