ID:               34244
 Updated by:       [EMAIL PROTECTED]
 Reported By:      d-tail at msx dot org
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Windows XP
 PHP Version:      5.1.0RC1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.


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

[2005-08-25 03:16:49] d-tail at msx dot org

Another workaround is this:
<?php
  $bread = "slice1.slice2.slice3.slice4";
  $last_slice = array_pop(@explode(".", $bread));
  echo($last_slice);
?>

Notice the '@' before the explode()-function.

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

[2005-08-25 02:58:28] d-tail at msx dot org

Description:
------------
The array_pop()-function (and most likely, similar array operators)
doesn't take immediate arrays anymore, that is, arrays without a
variable name. It worked in previous versions, though.

Reproduce code:
---------------
<?php
  $bread = "slice1.slice2.slice3.slice4";
  $last_slice = array_pop(explode(".", $bread));
  echo($last_slice);
?>


Expected result:
----------------
Expect to see: "slice4"

Workaround:
<?php
  $bread = "slice1.slice2.slice3.slice4";
  $slices_array = explode(".", $bread);
  $last_slice = array_pop($slices_array);
  echo($last_slice);
?>

Actual result:
--------------
Fatal error: Only variables can be passed by reference in
D:\www\browser\index.php on line 46


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


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

Reply via email to