Last active
August 2, 2017 08:00
-
-
Save oskarcalvo/028cd0fba2a7951e7423e45f523d6374 to your computer and use it in GitHub Desktop.
a function to clean arrays with empty values
This file contains hidden or 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
| <?php | |
| /** | |
| * Remove keys with empty values. | |
| * @param array $array | |
| * | |
| * @return array | |
| */ | |
| function clean_empty_values(array $array) { | |
| return array_filter($array, function ($item) { | |
| return empty($item) ? FALSE : TRUE; | |
| }, ARRAY_FILTER_USE_BOTH); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment