Skip to main content

Posts

Showing posts from December, 2019

How to search by multiple key => value in PHP array

<?php // PHP program to search for multiple // key=>value pairs in array function search($array, $search_list) {     // Create the result array     $result = array();     // Iterate over each array element     foreach ($array as $key => $value) {         // Iterate over each search condition         foreach ($search_list as $k => $v) {                 // If the array element does not meet             // the search condition then continue             // to the next element             if (!isset($value[$k]) || $value[$k] != $v)             {                 ...