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 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. Link to comment https://forums.phpfreaks.com/topic/286325-help-with-example-code/#findComment-1469553 Share on other sites More sharing options...
patswof Posted February 19, 2014 Author Share Posted February 19, 2014 Thank you very much. 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 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 Link to comment https://forums.phpfreaks.com/topic/286325-help-with-example-code/#findComment-1469563 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.