php剔除数组中指定值的元素

WBOY
Release: 2016-06-13 11:57:26
Original
1140 people have browsed it

php删除数组中指定值的元素

php删除数组中指定值的元素

/** * 删除数组中指定值的元素 * @author: ibrahim * @param array $arr 数组 * @param string $val 值 * @return boolean */function array_del(&$arr,$val){	if( empty($val) ) return false;	$key = array_search($val,$arr);	$keys= array_keys($arr);	$position = array_search($key,$keys);	if( false !== $position){		$r = array_splice($arr,$position,1);		return true;	}	return false;}
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!