Created
November 2, 2020 22:10
-
-
Save phpfiddle/b0bf00665ecfea096752f664012adfad to your computer and use it in GitHub Desktop.
[ Posted by Amar Beslija ] How to show PHP code inside HTML page for showcases or examples. https://lab387.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* If we want to show some PHP code inside HTML page for showcase, example, etc., here is the way to do it */ | |
// Code we want to show inside HTML page | |
$code = ' | |
<?php | |
echo "Test code to be output with everything else"; | |
?>'; | |
// Output full HTML Code, changing "<" and ">" to HTML Entities | |
echo "<pre>" . htmlspecialchars($code) . "</pre>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment