note 107289 added to function.array-filter

From: Date: Fri, 27 Jan 2012 18:14:23 +0000
Subject: note 107289 added to function.array-filter
Groups: php.notes 
Request: Send a blank email to php-notes+get-185768@lists.php.net to get a copy of this message
Improving on the array_filter_recursive function by romain dot lamarche at gmail dot com <?php function array_filter_recursive($array, $callback = null) { foreach ($array as $key => & $value) { if (is_array($value)) { $value = array_filter_recursive($value, $callback); } else { if ( ! is_null($callback)) { if ( ! $callback($value)) { unset($array[$key]); } } else { if ( ! (bool) $value) { unset($array[$key]); } } } } unset($value); return $array; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 205.204.33.82 ---- Manual Page -- http://www.php.net/manual/en/function.array-filter.php Edit -- https://master.php.net/note/edit/107289 Del: integrated -- https://master.php.net/note/delete/107289/integrated Del: useless -- https://master.php.net/note/delete/107289/useless Del: bad code -- https://master.php.net/note/delete/107289/bad+code Del: spam -- https://master.php.net/note/delete/107289/spam Del: non-english -- https://master.php.net/note/delete/107289/non-english Del: in docs -- https://master.php.net/note/delete/107289/in+docs Del: other reasons-- https://master.php.net/note/delete/107289 Reject -- https://master.php.net/note/reject/107289 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185768) next »