这是我的数组:
array(10) {
[0]=> string(29) "Cass Luxury Shapewear Bottoms"
[1]=> string(8) "xBhjsN9G"
[2]=> string(2) "20"
[3]=> string(57) "Cass Luxury Shapewear Bottoms. Multiple Styles Available."
[4]=> string(29) "cass-luxury-shapewear-bottoms"
[5]=> string(28) "Curabitur non nulla sit amet"
[6]=> string(8) "vjIhw8cw"
[7]=> string(3) "500"
[8]=> string(690) "posuere cubilia Curae; Donec velit neque."
[9]=> string(28) "curabitur-non-nulla-sit-amet"
}
删除此数组:
[5]=> string(28) "Curabitur non nulla sit amet"
[6]=> string(8) "vjIhw8cw"
[7]=> string(3) "500"
[8]=> string(690) "posuere cubilia Curae; Donec velit neque."
[9]=> string(28) "curabitur-non-nulla-sit-amet"
使用unset()
来取消这样的数组:
unset($array[5]); //if the index is 5
举个例子:
<?php
$array = array(
array(1),
array(2)
);
echo "<pre>";
print_r($array);
unset($array[1]);
echo "<pre>";
print_r($array);
?>
输出:
Array
(
[0] => Array
(
[0] => 1
)
[1] => Array
(
[0] => 2
)
)
Array
(
[0] => Array
(
[0] => 1
)
)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句