Overclock.net banner

PHP help

839 Views 7 Replies 6 Participants Last post by  Pap3r
FYI, Here is what I got (big thanks to FordGT90Concept at TPU)

print "Use While loop to calculate the sum: 1-10:";
print "
";
$number = 1;
$total = 0;

for ($number =1; $number <= 10; $number++)
{
print "$number
" ;

$total += $number;
}
Print "The Total is :$total";
1 - 8 of 8 Posts
2
Quote:

Originally Posted by newbie1911 View Post
so whats the problem?
I ran it and here's what I got:

Quote:
Use While loop to calculate the sum: 1-10:
1
2
3
4
5
6
7
8
9
10
The Total is :55
So I'd say the problem is all those
's!
See less See more
The
tag is an empty tag which means that it has no end tag. so
instead of
Obviously my attempt at humor failed.
theyre showing up because ur printing them in a php command
print "$number
" ;

try using an echo
print "$number" ; echo "
"

in xhtml u need to close ur breaklines
closing ->

in regular html u dont need to close the tag
i can see any problems.. what is it that your trying to achieve?
and like what Old_newb said.. move towards xhtml.. everyone should code standards compliant
Getting rid of those prints'll solve your issue. Go to http://www.tizag.com
1 - 8 of 8 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top