PHP variable variables

0 views
Skip to first unread message

zeesh...@gmail.com

unread,
Aug 9, 2006, 7:26:35 PM8/9/06
to phpguru
PHP variable variables

Sometimes it is convenient to be able to have variable variable names.
That is, a variable name which can be set and used dynamically.

Suppose a form is posted with element name s1, s2 ..... s17, then you
can view it through for loop using following code:

for($i=1;$i<17;$i++){
$n = ${"s".$i};
if($n) echo $n."<br>";
}

Please rate this php snippet.

Reply all
Reply to author
Forward
0 new messages