Created
May 10, 2013 11:10
-
-
Save shmaltorhbooks/5553782 to your computer and use it in GitHub Desktop.
delete empty items from array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$clearArr = array_diff($clearArr, array('')); | |
// 500 000 array_diff => 0.21610689163208 | |
public static function removeEmpty($var) { | |
return (!empty($var)); | |
} | |
$clearArr = array_filter($clearArr, "removeEmpty"); | |
// 500 000 removeEmpty => 0.067395925521851 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment