note 69489 deleted from function.highlight-string by bobby
| From: | bobby@php.net | Date: | Thu, 07 Sep 2006 15:08:19 +0000 |
| Subject: | note 69489 deleted from function.highlight-string by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116840@lists.php.net to get a copy of this message | ||
Note Submitter: Eegras at xenosgame dot com
Reason: bad code
----
I have made a quick PHP function to automatically add a php starting tag to codesnippets if it
doesn't already have one.
<?php
$source_explode = explode("\n", $source);
if (strpos($source_explode[0], '<?php') === false)
{
$source = "<?php " . $source;
}
return
str_replace(array("Ã","¶"," ","?>",
"<?php"), array("A",""," ","",
""), highlight_string($source, TRUE));
?>