note 96957 added to function.array-filter

From: Date: Thu, 25 Mar 2010 04:17:09 +0000
Subject: note 96957 added to function.array-filter
Groups: php.notes 
Request: Send a blank email to php-notes+get-167371@lists.php.net to get a copy of this message
<?php // array_filter with partial matches, optionally searches keys instead, optionally deletes blank (string) entries // useful for filtering for important $_POST variables function array_filter_partial($needle, $haystack, $filter_keys = false, $delete_blank = false) { if(!is_array($haystack)) return false; $new_arr = array(); foreach($haystack as $key=>$val) { $search = ($filter_keys) ? $key : $val; if($delete_blank && $val=='') continue; else if(strpos($search, $needle)!==false) $new_arr[$key] = $val; } return $new_arr; } ?> ---- Server IP: 202.89.58.1 Probable Submitter: 121.98.81.27 ---- Manual Page -- http://www.php.net/manual/en/function.array-filter.php Edit -- https://master.php.net/note/edit/96957 Del: integrated -- https://master.php.net/note/delete/96957/integrated Del: useless -- https://master.php.net/note/delete/96957/useless Del: bad code -- https://master.php.net/note/delete/96957/bad+code Del: spam -- https://master.php.net/note/delete/96957/spam Del: non-english -- https://master.php.net/note/delete/96957/non-english Del: in docs -- https://master.php.net/note/delete/96957/in+docs Del: other reasons-- https://master.php.net/note/delete/96957 Reject -- https://master.php.net/note/reject/96957 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167371) next »