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
https://forums.phpfreaks.com/topic/162339-solved-a-for-loop-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.