note 27174 added to function.each
| From: | erica@php.net | Date: | Tue, 26 Nov 2002 05:52:12 +0000 |
| Subject: | note 27174 added to function.each | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39971@lists.php.net to get a copy of this message | ||
I didn't see this listed anywhere on this page...
This is a piece of code that applies a PHP function to every value of an array. In this case, the
PHP function is addslashes().
while (list ($key, $val) = each ($row)) {
$row[$key] = addslashes($val);
}
That's all! Now every array value will have addslashes() applied. Substitute addslashes() with
the PHP function of your choice...
--
http://www.php.net/manual/en/function.each.php
http://master.php.net/manage/user-notes.php?action=edit+27174
http://master.php.net/manage/user-notes.php?action=delete+27174
http://master.php.net/manage/user-notes.php?action=reject+27174