note 57867 added to function.highlight-string

From: Date: Mon, 17 Oct 2005 11:37:09 +0000
Subject: note 57867 added to function.highlight-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-97115@lists.php.net to get a copy of this message
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). ---- Manual Page -- http://www.php.net/manual/en/function.highlight-string.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57867 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57867&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57867&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57867&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57867&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57867&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57867&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57867&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57867&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97115) next »