Re: PHP arrays managment bug :-?
| From: | Tomas V.V.Cox | Date: | Fri, 27 Jul 2001 13:38:03 +0000 |
| Subject: | Re: PHP arrays managment bug :-? | ||
| References: | 1 2 | Groups: | php.dev php.pear.dev |
| Request: | Send a blank email to php-dev+get-61216@lists.php.net to get a copy of this message | ||
Cynic wrote:
>
> >> >
> >> >1) array_pop() bug:
> >> ><?php
> >> >$a = array();
> >> >$a[] = array('foo', 'bar');
> >> >print_r($a);
> >> >$a[] = array('foo2', 'bar2');
> >> >print_r($a);
> >> >$a = array_pop($a);
> >> >print_r($a);
> >> >?>
>
>
> so, you're questioning the order of the retval assignment, and the
> popped array?
>
> >> >$a = array_pop($a);
> >> >print_r($a);
>
> change that $b = array_pop($a);
> print_r($b);
> and I think you'll see what you expected to see.
Oh, I was really idiot on that, $a is assigned by reference. Sorry, too
much strings :)
Tomas V.V.Cox