ID:               36451
 Updated by:       [EMAIL PROTECTED]
 Reported By:      epoc_32 at yahoo dot co dot ukXXX
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows XP
 PHP Version:      5.1.2
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

http://php.net/references


Previous Comments:
------------------------------------------------------------------------

[2006-02-19 02:50:39] epoc_32 at yahoo dot co dot ukXXX

Description:
------------
If you create an array inside array_pop(), expecting that array to be
popped then it isn't even though the last element of that array is
returned as expected.

Creating the array on the previous line makes array_pop() behave as
expected.

This behaviour doesn't occur in PHP4.3.x on FreeBSD. I only noticed it
when I upgraded to PHP 5.1.2 on my home WinXP machine though it's
possible it was broken but I didn't notice it in 5.0.x

Reproduce code:
---------------
$a=array(0, 1, 2, 3, 4, 5); // Set array first.
$offcut=array_pop($a); // Then pop array.
$length=count($a);
echo    "<pre>Array offcut: "
        .$offcut."\nArray length: "
        .$length."\nLast element: "
        .$a[$length-1]."</pre>\n";

$offcut=array_pop($a=array(0, 1, 2, 3, 4, 5)); // Set and pop at the
same time.
$length=count($a);
echo    "<pre>Array offcut: "
        .$offcut."\nArray length: "
        .$length."\nLast element: "
        .$a[$length-1]."</pre>\n";


Expected result:
----------------
Array offcut: 5
Array length: 5
Last element: 4

Array offcut: 5
Array length: 5
Last element: 4


Actual result:
--------------
Array offcut: 5
Array length: 5
Last element: 4

Array offcut: 5
Array length: 6
Last element: 5



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36451&edit=1

Reply via email to