implode
将数组变成字符串。
语法: string implode(string glue, array pieces);
返回值: 字符串
函数种类: 资料处理
| |
内容说明 |
本函数将数组的内容组合成一个字符串,参数 glue 是字之间的分隔符号。
| |
使用范例 |
<?
$array=array("1","1","2");
$colon_separated = implode(",", $array);
echo $colon_separated;
?>
结果
mysql 中 select * from app_customer where id in(5,5,7)
更可以配合分页显示,前几条
显示前一条:select * from app_customer where id in(5,5,7) LIMIT 0,1
总条数:select count(*) from app_customer where id in(5,5,7)
========================================================================字符串转数组 explode ,以分割符将字符串拆分组成数组
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2