Created
February 10, 2012 09:23
-
-
Save rtxbc/1787992 to your computer and use it in GitHub Desktop.
删除数组元素 【php】
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment