I am wondering how easy/hard it is to create a parser, where you can insert PHP into a textarea and on the output page it will colour PHP accordingly. Like the one on this forum. Is it a server installation? Downloadable code? Thanks
Announcement
Collapse
No announcement yet.
PHP parser - like the ones on here
Collapse
X
-
You'd need to use regex to do that, I'm not good at it but will see if this works for you
Code:<?php $str = '[ php]<?php echo "la de la"; ?>[/ php]'; $str = preg_replace("/^[php](.*?)[/\php]/$",highlight_string(\\1),$str); echo $str; ?>
Comment
-
im not great myself, but try:
PHP Code:<?php
$str = '[[b][/b]php]<?php echo "la de la"; ?>[/[b][/b]php]';
$str = preg_replace("/\\[php\\](.*)[\\/php\\]/ise", highlight_string("$1"), $str);
echo $str;
?>PHP Weekly - A PHP Developers Resource
PHP 5.1.4 and Ruby on Rails web hosting
Moderator of PHP and Work offers and Requests
Install Apache/PHP/MySQL (by marek_mar) | TinyPlugin Architecture
Comment
Comment