Variable question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Variable question

Post 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.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Variable question

Post by Weirdan »

Code: Select all

 
$_FILES['image' . $z]
 
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Re: Variable question

Post by spacebiscuit »

Thanks that worked geat!

Rob.
Post Reply