Hallo Andreas,
ich möchte den Schleifenzähler in eine Variable einbauen.
$b1 = "Hallo";
$b2 = "Test";
for($i=1; $i<=2; $i++){
echo $("b".$i);
}So würde es in etwa in VBA funktionieren, aber wie in PHP?
In PHP geht's so (Quelle):
$b1 = 'Hallo';
$b2 = 'Test';
for ($i = 1; $i <= 2; $i++) {
echo ${'b'.$i};
}
Grüße
Marc Reichelt || http://www.marcreichelt.de/
--
Linux is like a wigwam - no windows, no gates and an Apache inside!
Selfcode: ie:{ fl:| br:> va:} ls:< fo:} rl:( n4:( ss:) de:> js:| ch:? sh:| mo:) zu:)
http://emmanuel.dammerer.at/selfcode.html
Linux is like a wigwam - no windows, no gates and an Apache inside!
Selfcode: ie:{ fl:| br:> va:} ls:< fo:} rl:( n4:( ss:) de:> js:| ch:? sh:| mo:) zu:)
http://emmanuel.dammerer.at/selfcode.html