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 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 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 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 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.