patswof Posted February 19, 2014 Share Posted February 19, 2014 I am trying to teach myself php and I have a question about an example code from the book I am using. <?php if (!empty($error_message)) { ?> <p class="error"><?php echo $error_message; ?></p> <?php } ?> I understand what the code does but I don't understand the break up of the opening and closing tags of the php. I appreciate any help Quote Link to comment https://forums.phpfreaks.com/topic/286325-help-with-example-code/ Share on other sites More sharing options...
WebStyles Posted February 19, 2014 Share Posted February 19, 2014 you could write the same thing like this: <?php if (!empty($error_message)) { echo '<p class="error">' . $error_message . '</p>'; } ?> Whoever wrote that code is just trying to keep html code out of the php tags. Quote Link to comment https://forums.phpfreaks.com/topic/286325-help-with-example-code/#findComment-1469553 Share on other sites More sharing options...
Solution patswof Posted February 19, 2014 Author Solution Share Posted February 19, 2014 Thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/286325-help-with-example-code/#findComment-1469562 Share on other sites More sharing options...
Ch0cu3r Posted February 19, 2014 Share Posted February 19, 2014 (edited) You may find the following pages from the manual useful http://php.net/manual/en/language.basic-syntax.phptags.php http://www.php.net/manual/en/language.basic-syntax.phpmode.php Edited February 19, 2014 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/286325-help-with-example-code/#findComment-1469563 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.