public
Created

删除数组元素 【php】

  • Download Gist
gistfile1.aw
PHP
1 2 3 4 5 6 7 8 9 10
<?php
$t = array(1, 3, 4, 5);
var_dump($t);
foreach($t as $k => &$v){
if(1 === $k){
unset($t[$k]);
//unset($v); //这种方法不起作用
}
}
var_dump($t);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.