PHP数组和explode函数应用实例,供大家学习参考。

例1:

<"北京","上海","天津","重庆","河北","山西","内蒙古","辽宁","吉林","黑龙江","江苏","浙江","安徽","福建","江西","山东","河南","湖北","湖南","广东","广西","海南","四川","贵州","云南","西藏","陕西","甘肃","宁夏","青海","新疆","香港","澳门","台湾","其他");
echo count($province);//数组成员个数
echo "<br/>";

if(is_array($province)){//检测变量是否是数组
  echo "嗯,真是个数组啊";
}
echo "</br>";

for($index=0;$index<count($province);$index++){//数组循环
echo $province[$index];
echo "</br>";
}
"htmlcode">
<"hello1,hello2,hello3,hello4,hello5";//按逗号分离字符串
$hello = explode(',',$source);

for($index=0;$index<count($hello);$index++){
echo $hello[$index];echo "</br>";
}
"htmlcode">
<"04/30/1973";
list($month, $day, $year) = split ('[/.-]', $date);
echo "Month: $month; Day: $day; Year: $year<br />\n";
?>

以上所述就是本文的全部内容了,希望大家能够喜欢。

标签:
PHP数组,explode函数

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“PHP数组和explode函数示例总结”

暂无“PHP数组和explode函数示例总结”评论...