Re: modifying a substring

From: Date: Tue, 27 Apr 2004 02:39:45 +0000
Subject: Re: modifying a substring
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-23553@lists.php.net to get a copy of this message
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.

« previous php.windows (#23553) next »