View unanswered posts | View active topics It is currently Mon May 23, 2022 1:05 am



Reply to topic  [ 2 posts ] 
 Problem with PHP coding 
Author Message
Junior Member

Joined: Mon Nov 30, 2009 11:08 am
Posts: 1
Post Problem with PHP coding
Hello all I need your help I’m trying to change my java script to PHP scripts, having problems with coding and PHP execution.
Thanks in advance,
Sj

<script type="text/javascript">
var Hello = 1;
while(Hello<=7)
{
document.write("<font size="+Hello+">Hello</font>
");
Hello = Hello +1;
}
</script>

<?php
var $Hello=1;
while($Hello<=7)
{
print("<font size=".$Hello.">Hello</font>
");
print("
");
$Hello = $Hello .1;
}
?>


Mon Nov 30, 2009 7:09 pm
Report this post
Profile
Junior Member

Joined: Tue Dec 01, 2009 8:34 pm
Posts: 7
Location: Ohio, USA
Post Quick Fix
There is only one syntax problem with your code:

$Hello = $Hello . 1;
..should be...
$Hello = $Hello + 1;

This assumes you are trying to increment $Hello by 1 each time through the loop.
You can also use:
$Hello++;


Tue Dec 01, 2009 8:43 pm
Report this post
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.