Andy11548 Posted January 18, 2012 Share Posted January 18, 2012 How would I show the PHP code on the website page? I'm not sure if this should be under PHP or HTML or what, but, like on the forums where you see the <?php echo 'sdfjksdf'; ?> etc. How do I make it so I can write PHP on the website? Link to comment https://forums.phpfreaks.com/topic/255306-show-php-on-the-website/ Share on other sites More sharing options...
Psycho Posted January 18, 2012 Share Posted January 18, 2012 Use <pre> tags and htmlentities(): $php_code = "<?php echo 'sdfjksdf'; ?>"; echo "<pre>" . htmlentities($php_code) . "</pre>"; Link to comment https://forums.phpfreaks.com/topic/255306-show-php-on-the-website/#findComment-1308972 Share on other sites More sharing options...
scootstah Posted January 18, 2012 Share Posted January 18, 2012 htmlspecialchars() Link to comment https://forums.phpfreaks.com/topic/255306-show-php-on-the-website/#findComment-1308973 Share on other sites More sharing options...
Psycho Posted January 18, 2012 Share Posted January 18, 2012 Yeah, htmlspecialchars() is a better choice. I always mix the two up. Link to comment https://forums.phpfreaks.com/topic/255306-show-php-on-the-website/#findComment-1308982 Share on other sites More sharing options...
Andy11548 Posted January 18, 2012 Author Share Posted January 18, 2012 Thanks for the help Link to comment https://forums.phpfreaks.com/topic/255306-show-php-on-the-website/#findComment-1308987 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.