Home >Backend Development >PHP Tutorial >PHP method to find a specific value in a multidimensional array

PHP method to find a specific value in a multidimensional array

WBOY
WBOYOriginal
2016-07-25 09:05:351974browse
  1. public function searchArray($array,$key,$value){
  2. foreach($array as $keyp=>$valuep){
  3. if($valuep[$key]== $value){
  4. unset($array[$keyp]);
  5. }
  6. }
  7. return $array;
  8. }
  9. ?>
Copy code

Articles you may be interested in: Introduction to how to create an array in php php uses array_unique to determine whether the same value exists in the array php array function in_array() finds whether the specified value exists in the array PHP array function array_key_exists() finds whether the array key exists Small example of php array deduplication An example of usage of php function array_merge () (merging similar arrays) Enhanced version of array_unique function (supports two-dimensional array) Learn to sort multi-dimensional arrays in php php multidimensional array sorting example Understanding of several array functions in php Application example of php array callback filter function array_filter() PHP functions and application examples for extracting variables from arrays PHP code for sorting multi-dimensional arrays by a certain value PHP code to randomly extract some elements from an array Code to automatically add links to article content using php array How to add and delete array elements in php



Statement:
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