geekette Posted March 4, 2009 Share Posted March 4, 2009 I wrote the following..: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Arithmetic Examples</title> </head> <body> <?php $Number = 100; $Result = 0; $Result = $Number + 50; echo '<p>$Result after addition = ', $Result, "<br />"; $Result = $Number / 4; echo '$Result after division = ', $Result, "<br />"; $Result = $Number - 25 echo '$Result after subtraction = ', $Result, "<br />"; $Result = $Number * 2; echo '$Result after multiplication = ', $Result, "<br />"; $Result = ++$Number; echo '$Result after increment = ', $Result, "</p>"; ?> </body> </html> and received the following in my browser..: Parse error: syntax error, unexpected T_ECHO in /Applications/xampp/xamppfiles/htdocs/xampp/classfolder/ch3/arithmeticexamples.php on line 18 I also validated it using the WDG Validator, but received no errors, so I'm confused as to why this isn't rendering correctly..any help would be appreciated! Edited for mispasting what my browser displayed. Link to comment https://forums.phpfreaks.com/topic/148006-solved-operator-expresison-issues/ Share on other sites More sharing options...
Mchl Posted March 4, 2009 Share Posted March 4, 2009 We cannot see pages on your computer. Link to comment https://forums.phpfreaks.com/topic/148006-solved-operator-expresison-issues/#findComment-776810 Share on other sites More sharing options...
geekette Posted March 4, 2009 Author Share Posted March 4, 2009 Opps, i pasted it incorrectly...this is what I received..: Parse error: syntax error, unexpected T_ECHO in /Applications/xampp/xamppfiles/htdocs/xampp/classfolder/ch3/arithmeticexamples.php on line 18 Except, there appears to be nothing wrong that I can see with regards to line 18. Link to comment https://forums.phpfreaks.com/topic/148006-solved-operator-expresison-issues/#findComment-776812 Share on other sites More sharing options...
Mchl Posted March 4, 2009 Share Posted March 4, 2009 You forgot ; in this line $Result = $Number - 25 Please paste your code within tags. It will be easier to read. Link to comment https://forums.phpfreaks.com/topic/148006-solved-operator-expresison-issues/#findComment-776816 Share on other sites More sharing options...
geekette Posted March 4, 2009 Author Share Posted March 4, 2009 Thanks! And I'll keep the / tags in mind next time! Also, do you know of better validator sites? The one I use evidently doesn't like to show all errors. Link to comment https://forums.phpfreaks.com/topic/148006-solved-operator-expresison-issues/#findComment-776821 Share on other sites More sharing options...
kenrbnsn Posted March 4, 2009 Share Posted March 4, 2009 Validators check the generated HTML, not the PHP source that generates the HTML. Ken Link to comment https://forums.phpfreaks.com/topic/148006-solved-operator-expresison-issues/#findComment-776824 Share on other sites More sharing options...
Mchl Posted March 4, 2009 Share Posted March 4, 2009 Follow the 'PHP Debugging: A Beginner's guide' link in my signature. It contains lots of useful information about nailing down such errors. Link to comment https://forums.phpfreaks.com/topic/148006-solved-operator-expresison-issues/#findComment-776829 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.