标签:数组 count log class 操作 存在 php数组 div car
关于php数组的操作
1、在foreach循环中如何判断是否已经到数组末尾
<?php $cars = array("benz" , "audi" , "das auto"); foreach ($cars as $key => $value) { if ($value == "das auto") {echo "已经存在"; break;}; if ($key == count($cars)-1) echo "不存在"; }
2、给数组赋值(不必考虑数组的下标)
foreach ($cars as $value) { $cars_news[] = $value; }
标签:数组 count log class 操作 存在 php数组 div car
原文地址:http://www.cnblogs.com/hhssqq9999/p/7689469.html