note 23375 added to function.eval
| From: | taq at terra dot com dot br | Date: | Tue, 16 Jul 2002 22:18:27 +0000 |
| Subject: | note 23375 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-33185@lists.php.net to get a copy of this message | ||
I was trying to check a lot of form fields with a PHP loop, and made this way, suppose your form
fields are called p0,p1...p50, and you need to check all the values from 1 to 50, so:
for( $i=0; $i<50; $i++ )
{
$var = "";
eval( "\$var = \$p$i;" );
print $var; // give you the field value
}
--
http://www.php.net/manual/en/function.eval.php
http://master.php.net/manage/user-notes.php?action=edit+23375
http://master.php.net/manage/user-notes.php?action=delete+23375
http://master.php.net/manage/user-notes.php?action=reject+23375