PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

levenshtein> <implode
Last updated: Mon, 26 Nov 2007

view this page in

join

(PHP 4, PHP 5)

join — 别名 implode()

说明

本函数是该函数的别名: implode().



add a note add a note User Contributed Notes
join
tobias at dcode dot se
10-Apr-2008 06:48
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;
}

?>
manbss at yahoo dot co dot in
10-May-2007 12:38
<?php

$array
= array('lastname', 'email', 'phone');
$comma_separated = join(",", $array);

echo
$comma_separated; // lastname,email,phone

?>

levenshtein> <implode
Last updated: Mon, 26 Nov 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites