note 57867 deleted from function.highlight-string by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 14:54:19 +0000 |
| Subject: | note 57867 deleted from function.highlight-string by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197218@lists.php.net to get a copy of this message | ||
Note Submitter: growlingoctopus at no-spam dot gmail dot com
----
Here's a trick I use when I want to show people the source to one of my scripts, but don't
feel like uploading phps files or the host doesn't support them.
<?php
if (!empty($_GET['source'])) {
$f = implode(file(substr(__FILE__,strrpos(__FILE__,'/')+1)));
highlight_string(trim(substr($f,strpos($f,'?'.'>')+2)));
exit();
}
?>
By adding that to the top of the script, you can then call the script with ?source=1 and it will
show the source for the file ... it should work with any script (as long as you aren't using
$_GET['source'] for something else, you can always change that if you do).