note 52371 added to function.implode

From: Date: Thu, 28 Apr 2005 20:54:57 +0000
Subject: note 52371 added to function.implode
Groups: php.notes 
Request: Send a blank email to php-notes+get-88716@lists.php.net to get a copy of this message
/* english_list() This one works with anything, since the array is passed by reference, modifying it in the function via pop has no effect on the array outside the function. But it can't be done on one line, because the array_pop() must occur before the join(). */ function english_list($array, $oxfordComma=0) { $last = array_pop($array); return join(", ", $array) . ($oxfordComma ? "," : "") . " and " . $last; } ---- Manual Page -- http://www.php.net/manual/en/function.implode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52371 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52371&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52371&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52371&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52371&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52371&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52371&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88716) next »