Date: 04/12/00
- Next message: Andrew Skalski: "[PHP-DEV] cvs: /php3/functions post.c"
- Previous message: Jeff Strain: "[PHP-DEV] *NEWBIE IN TROUBLE* MSSQL and PHP on win32 platform"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: alexphpbug <email protected>
Operating system: Redhat linux 6.0 i386 SMP
PHP version: 4.0 Beta 4 Patch Level 1
PHP Bug Type: Misbehaving function
Bug description: array_walk allows userdata to be passed by ref but only half works
The following code demonstrates the 'feature' ...
<CODE>
function myfunc(&$value, $key, &$user) {
$value = "$user:$value";
$user++;
printf("%3d : %s\n", $key, $value);
}
$myarray=array("one", "two", "three");
$myvar=1;
array_walk($myarray, "myfunc", $myvar);
echo "myvar=$myvar";
</CODE>
This code outputs the following ...
<SAMP>
0 : 1:one
1 : 2:two
2 : 3:three
myvar=1
</SAMP>
myvar has been incremented between calls within array_walk but the final
value is not passed back to the original variable.
I understand that the above usage is not mentioned in the docs but it would
be a nice feature to have. The current functionality seems to be somewhat
inconsistent and I doubt its usefulness.
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andrew Skalski: "[PHP-DEV] cvs: /php3/functions post.c"
- Previous message: Jeff Strain: "[PHP-DEV] *NEWBIE IN TROUBLE* MSSQL and PHP on win32 platform"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

