php删除数组中的元素的方法:可以利用unset()函数来进行删除。unset()函数可以销毁给定的变量,例如我们要删除单个数组元素则代码为:【unset ($bar['quux']);】。
我们可以使用unset()函数来删除数组中的特定元素。
(推荐教程:php视频教程)
语法:
void unset (1 V H g q Q % mixed $var [c e c = & S, mixed $... ] )
(7 G f : -相关推荐:php培训)
代码示例:
<?php // 销毁单个变量 unset ($foo); // 销毁单个数组元素 unset ($bar['quux']); // 销毁一个以上的变H v / m [ Y量 unset($foo1, $foo2, $foo3); ?>
举例:
foreach($array as $k=>$v){ if($v == 'day'){ unset($array[$k]): } }
以上就是php怎样删除数组c 4 ? c 1 o中的元素的详细内容。