// 删除数组内特定元素 function array_delete ($needle, $haystack, $all = true) { $haystack_updated = $haystack; foreach ($haystack as $num => $val) { if ($val == $needle && $all) { unset ($haystack_updated [$num]); } elseif ($val == $needle && $all === false && !isset ($done)) { $done = true; unset ($haystack_updated [$num]); } } $haystack_updated = array_values ($haystack_updated); return $haystack_updated; }