1, the implode () function returns a string composed of array elements, function syntax: string implode (Separator,array), optional separator parameter, specifies what is placed between array elements, default is an empty string The array parameter represents an array to be combined into a string.
Instance:
1 <? PHP 2 $arr Array (' Hello ', ' world! ', ' I ', ' love ', ' shanghai! ' ); 3 Echo implode ("",$arr); 4 ?>
Output:
Hello world! I Love shanghai!
The 2,explode () function returns an array of strings that are separated by a string delimiter as a boundary point. function syntax: array explode (string $delimiter, String $string) $delimiter represents a split character on a boundary, $string a string representing the input.
1<?PHP2 $data= "Foo:*:1023:1000::/home/foo:/bin/sh";3 List($user,$pass,$uid,$gid,$gecos,$home,$shell) =Explode(":",$data);4 Echo $user;//Foo5 Echo $pass;// *6?>
Output:
Foo 2013
PHP implode () and explode ()