note 20853 deleted from function.array-walk by aidan
| From: | aidan@php.net | Date: | Sun, 11 Jul 2004 02:10:06 +0000 |
| Subject: | note 20853 deleted from function.array-walk by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73036@lists.php.net to get a copy of this message | ||
Note Submitter: wes-at-marriedguys-dot-com
----
This might be overly-obvious, but when using array_walk(), the function being called should not
return anything.
For example, imagine a function that does a basic clean-up of a form field:
function clean_up ($field) {
$field = trim($field);
$field = strip_tags($field);
return $field;
}
This works just fine when passing it a variable like a single field, but if passing it an array,
then you need to remove the return line.
function clean_up_array (&$fields_array) {
$fields_array = trim($fields_array);
$fields_array = strip_tags($fields_array);
}