Skip to content

Instantly share code, notes, and snippets.

@shmaltorhbooks
Created May 10, 2013 11:10
Show Gist options
  • Save shmaltorhbooks/5553782 to your computer and use it in GitHub Desktop.
Save shmaltorhbooks/5553782 to your computer and use it in GitHub Desktop.
delete empty items from array
$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