note 93273 added to function.highlight-file

From: Date: Mon, 31 Aug 2009 23:52:09 +0000
Subject: note 93273 added to function.highlight-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-160097@lists.php.net to get a copy of this message
Just my two cents - a function that takes PHP source code from a file and decodes it to text/plain MIME-type. Cheers, Joel A. Villarreal Bertoldi #################################### function phps2array($fileName) { return explode("\r", html_entity_decode(strip_tags(highlight_file($fileName, true)))); } #################################### Example: #################################### samplefile.php: <?php $a = 1; /* This is my file*/ echo $a; ?> parser.php: <?php header("Content-Type: text/plain"); print_r(parse_php_file("samplefile.php")); ?> #################################### Results: #################################### Array ( [0] => <?php [1] => $a = 1; [2] => [3] => /* This is my file*/ [4] => echo $a; [5] => ?> ) #################################### ---- Server IP: 190.2.55.64 Probable Submitter: 190.246.204.51 ---- Manual Page -- http://www.php.net/manual/en/function.highlight-file.php Edit -- https://master.php.net/note/edit/93273 Del: integrated -- https://master.php.net/note/delete/93273/integrated Del: useless -- https://master.php.net/note/delete/93273/useless Del: bad code -- https://master.php.net/note/delete/93273/bad+code Del: spam -- https://master.php.net/note/delete/93273/spam Del: non-english -- https://master.php.net/note/delete/93273/non-english Del: in docs -- https://master.php.net/note/delete/93273/in+docs Del: other reasons-- https://master.php.net/note/delete/93273 Reject -- https://master.php.net/note/reject/93273 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#160097) next »