Page 1 of 1

Variable question

Posted: Mon Jun 15, 2009 11:01 am
by spacebiscuit
Hi guys,

Consider the following code:

Code: Select all

while($z<6){
     if($_FILES['image'.'$z']['name']){
         do something
                                                  }
 
     $z++
                }


As you can see i am trying to concatenate the the variable $z to the 'image' string in the file variable name. ie:

image1
image2

and so on... Is this possible.

Thanks in advance,

Rob.

Re: Variable question

Posted: Mon Jun 15, 2009 11:07 am
by Weirdan

Code: Select all

 
$_FILES['image' . $z]
 

Re: Variable question

Posted: Mon Jun 15, 2009 11:33 am
by spacebiscuit
Thanks that worked geat!

Rob.