Jump to content

Recommended Posts

Is there a way to call a specific variable by adding the i from a for loop? For example:

 

I have variables Branch0 Branch1 Branch2 being submitted from a form to be processed.

 

I am using a for loop to write the values of these variables.

 

I tried this but it doesn't work:

for ( $i = 0; $i < 15; $i++ ){
	echo $Branch$i;
}

I also tried this:

for ( $i = 0; $i < 15; $i++ ){
	echo $Branch+$i;
}

 

So is there any way to call a variable using the i to specify which variable...?

 

I know I could use an array but it doesn't work for this application  ???

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.