Re: modifying a substring

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Yu wrote:
Hi guys
I want to do some fancy syntax highlighting so I added <code> </code> to my
input text.
Is there a way to take the entire input text, but only take the substring
between those tags, do something to the substring and put it back into the
original text?
Thanks in advance
John



PHP has a built in syntax-highlighting function, so you could use that along with preg_replace to highlight the code. You could also use ini_set() to change the color values if you don't have access to php.ini directly.


http://www.php.net/highlight_string

Even if you don't want to use the built-in function, preg_replace is probably the best way to do what you want to do.

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux