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
chaza
Forum Newbie
Posts: 10 Joined: Fri Oct 10, 2003 11:28 am
Post
by chaza » Sun Apr 04, 2004 10:27 am
how can I output these variables in a for loop?
...not like this - but maybe not far off...
Code: Select all
<?php
$c0=1;
$c1=1;
$c2=0;
$c3=0;
$c4=1;
$c5=1;
for ($x=0;$x<6;$x++) {
print $c{$x};
}
?>
Deemo
Forum Contributor
Posts: 418 Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC
Post
by Deemo » Sun Apr 04, 2004 11:25 am
you could just use an array
markl999
DevNet Resident
Posts: 1972 Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)
Post
by markl999 » Sun Apr 04, 2004 8:17 pm
Or..
for ($x=0;$x<6;$x++) {
print ${'c'.$x};
}