Re: PHP 4.0 Bug #2956 Updated: array_walk not working as it did in php 3.0?
| From: | Andrei Zmievski | Date: | Sat, 11 Dec 1999 04:11:07 +0000 |
| Subject: | Re: PHP 4.0 Bug #2956 Updated: array_walk not working as it did in php 3.0? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-13575@lists.php.net to get a copy of this message | ||
At 02:00 AM 12/11/99 +0000, Bug Database wrote:
>Actually, it also states in the php3 documentation for array_walk that:
>
>"func will actually be working with the elements of arr, so any changes made
>to those elements will actually be made in the array itself"
>
>However this is not true in php4 yet... I had to put a & before the $item1
>parameter of test_alter to get the changes back to the array. This is also
>not similar to php3 behaviour. Removing the '&' will not return the
>changes to the array.
>Unfortunately, I realized this immediately after I clicked submit the first
>time...
In PHP4 you need to explicitly specify & to have it work as a reference.
You shouldn't use php3 documentation when working with PHP4.
-Andrei