Created
February 25, 2022 21:33
-
-
Save JackZielke/a32821d76e529a39e72413f90c4b7efb to your computer and use it in GitHub Desktop.
View highlighted PHP source code oneliner
This file contains 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 (isset($_GET['viewsource'])) { die(highlight_file(__FILE__, 1)); } | |
// Put the rest of your PHP code here | |
// Somewhere in the code add the following HTML line (or something similar to it). | |
<a rel="nofollow" href="?viewsource">View Source</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This creates the same output you would get from a .phps file. It uses the built-in syntax highlighter.