note 89456 deleted from function.implode by danbrown
| From: | danbrown@php.net | Date: | Mon, 09 Mar 2009 00:39:01 +0000 |
| Subject: | note 89456 deleted from function.implode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151641@lists.php.net to get a copy of this message | ||
Note Submitter: Aule
----
To crashinside: I think this would be better:
<?php
function mt_implode($glue,$array)
{
$lem = array_keys($array);
$glue = htmlentities($glue);
$sizem1 = sizeof($lem)-1;
for($i=0;$i<$sizem1;++$i)
$str .= $array[$lem[$i]].$glue;
return $str.$array[$lem[$sizem1]];
}
?>
It reduces a few subtractions and logical operations.