謝晒的PHP網頁設計
聯絡E-mail:
sean0704@gmail.com
站內搜尋
Wednesday, October 30, 2013
[PHP] 在迴圈裡刪除陣列的元素 (用unset)
$arr['a'] = 'x';
$arr['b'] = 'y';
$arr['c'] = 'z';
foreach($arr as $k => $v){
if($v == 'y'){
unset($arr[$k]);
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment