implode()把数组拆分成字符串
explode()把字符串拆分成数组
例子
<?php
$str = "Hello world. It's a beautiful day.";
print_r (explode(" ",$str));
?>
输出:
Array([0] => Hello[1] => world.[2] => It's[3] => a[4] => beautiful[5] => day.)
例子
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
?>输出:
Hello World! Beautiful Day!