Jump to content

[SOLVED] a for loop problem


sw45acp

Recommended Posts

How can a for loop be written to write out this sentence x number of times and only increment the number after $bla by one each time? ($bla1, $bla2, etc.). But keep in mind that $bla1 and $bla2 and so on are already variables in an early script.

 

echo (function foobar($woof,$bla1) == $something) ? "laskjflasjf $bla1" : "<s>$bla1</s>";
echo (function foobar($woof,$bla2) == $something) ? "laskjflasjf $bla2" : "<s>$bla2</s>";

 

 

I was thinking something like this:

 

for ($x = 1; $x<=3; $x++)
{
   echo (function foobar($woof,$bla$x) == $something) ? "laskjflasjf $bla$x" : "<s>$bla$x</s>";
}

 

but it doesnt work because the foobar() function only allows two variables, and I think because of the fact that $bla is alreay a variable. Any help would be appreciated

Link to comment
Share on other sites

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.