Created
July 3, 2011 10:26
-
-
Save justinkelly/1062130 to your computer and use it in GitHub Desktop.
PHP function to strip null array entries
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
<?php | |
/* | |
* use this function to strip null array entries from an array | |
* useful when doing a db update with pdo/zend_db_table etc.. | |
*/ | |
function strip_null_array_entries($values){ | |
$array = array(); | |
foreach($values as $key=>$value){ | |
if( ($value!=='') AND (!is_null($value)) ) $array[$key] = $value; | |
} | |
return $array; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment