note 2732 modified in Variable variables by ronabop

From: Date: Sat, 10 Mar 2001 23:38:53 +0000
Subject: note 2732 modified in Variable variables by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-12243@lists.php.net to get a copy of this message
Concerning the ${x_$n} trick. It's a typical task to process several (the exact number may be unknown) files uploaded via an html form. You get them as file1, file2, ... , file"n" in PHP. for($i=1;${"file".$i};$i++) { echo(${"file".$i}); } Note the double-quotes. I was getting parsing errors without them. Tested for PHP4. http://www.php.net/manual/variable-variables.php

« previous php.notes (#12243) next »