note 19330 added to function.array-filter

From: Date: Sat, 23 Feb 2002 22:13:33 +0000
Subject: note 19330 added to function.array-filter
Groups: php.notes 
Request: Send a blank email to php-notes+get-26973@lists.php.net to get a copy of this message
Leveraging PHP functions as callbacks can be especially useful. A handy one is strlen(), as you can use it to filter out entries that don't have values. (Sometimes if $HTTP_POST_VARS is huge, I like to limit it down to those entries that were actually filled.) $post_filtered = array_filter( $HTTP_POST_VARS, "strlen" ); Use trim() if some entries have whitespace: $post_filtered = array_filter( $str_array, "trim" ); -- http://www.php.net/manual/en/function.array-filter.php http://master.php.net/manage/user-notes.php?action=edit+19330 http://master.php.net/manage/user-notes.php?action=delete+19330 http://master.php.net/manage/user-notes.php?action=reject+19330

« previous php.notes (#26973) next »