note 58209 added to function.end

From: Date: Thu, 27 Oct 2005 16:02:24 +0000
Subject: note 58209 added to function.end
Groups: php.notes 
Request: Send a blank email to php-notes+get-97700@lists.php.net to get a copy of this message
Please note that from version 5.0.4 ==> 5.0.5 that this function now takes an array. This will possibly break some code for instance: <?php echo ">> ".end(array_keys(array('x' => 'y')))."\n"; ?> which will return "Fatal error: Only variables can be passed by reference" in version <= 5.0.4 but not in 5.0.5. If you run into this problem with nested function calls, then an easy workaround is to assign the result from array_keys (or whatever function) to an intermediary variable: <?php $x = array_keys(array('x' => 'y')); echo ">> ".end($x)."\n"; ?> ---- Manual Page -- http://www.php.net/manual/en/function.end.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58209 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58209&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58209&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58209&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58209&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58209&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58209&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58209&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58209&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97700) next »