note 112155 added to function.array-filter

From: Date: Fri, 10 May 2013 12:56:43 +0000
Subject: note 112155 added to function.array-filter
Groups: php.notes 
Request: Send a blank email to php-notes+get-194774@lists.php.net to get a copy of this message
If you need this function to return falsy results (like "0"), yet discard truly empty ones (that have a 0 string length, like null, false, ''), you can use strlen() as the callback: <?php array_filter($array, 'strlen'); ?> Another option is to use the ord() as the callback, which should be ~7-8% faster on average (because it only uses the first character). ---- Server IP: 194.8.30.16 Probable Submitter: 109.50.178.32 ---- Manual Page -- http://php.net/manual/en/function.array-filter.php Edit -- https://master.php.net/note/edit/112155 Del: integrated -- https://master.php.net/note/delete/112155/integrated Del: useless -- https://master.php.net/note/delete/112155/useless Del: bad code -- https://master.php.net/note/delete/112155/bad+code Del: spam -- https://master.php.net/note/delete/112155/spam Del: non-english -- https://master.php.net/note/delete/112155/non-english Del: in docs -- https://master.php.net/note/delete/112155/in+docs Del: other reasons-- https://master.php.net/note/delete/112155 Reject -- https://master.php.net/note/reject/112155 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194774) next »