note 82415 deleted from function.join by nlopess

From: Date: Sat, 12 Apr 2008 10:33:52 +0000
Subject: note 82415 deleted from function.join by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138228@lists.php.net to get a copy of this message
Note Submitter: tobias at dcode dot se ---- Why do not this type of function exists or have I missed something? <?php /** * Extended join with max option and end delimiter * * @param array $pieces * @param int $max * @param string $glue * @param string $end * @return string */ function join_max($pieces=array(), $max, $glue=', ', $end='') { $a = array(); foreach($pieces as $piece) { if (count($a) <= $max) array_push($a, $piece); } return join($glue, $a) . $end; } ?>

« previous php.notes (#138228) next »