Home > Backend Development > PHP Tutorial > php剔除数组中指定值的元素

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:57:26
Original
1198 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:
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
Latest Issues
How to create an array within an array?
From 1970-01-01 08:00:00
0
0
0
php array
From 1970-01-01 08:00:00
0
0
0
Array to array
From 1970-01-01 08:00:00
0
0
0
php array rotation
From 1970-01-01 08:00:00
0
0
0
array
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template