note 93274 added to function.highlight-file
| From: | design at joelalejandro dot com dot ar | Date: | Mon, 31 Aug 2009 23:52:16 +0000 |
| Subject: | note 93274 added to function.highlight-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160098@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/93274
Del: integrated -- https://master.php.net/note/delete/93274/integrated
Del: useless -- https://master.php.net/note/delete/93274/useless
Del: bad code -- https://master.php.net/note/delete/93274/bad+code
Del: spam -- https://master.php.net/note/delete/93274/spam
Del: non-english -- https://master.php.net/note/delete/93274/non-english
Del: in docs -- https://master.php.net/note/delete/93274/in+docs
Del: other reasons-- https://master.php.net/note/delete/93274
Reject -- https://master.php.net/note/reject/93274
Search -- https://master.php.net/manage/user-notes.php