highlight_string()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nwp
Forum Contributor
Posts: 105
Joined: Sun Feb 04, 2007 12:25 pm

highlight_string()

Post by nwp »

highlight_string() Prints the highlighted string but i wanna do like this

Code: Select all

$str = highlight_string($line);
e.g. $str will hold the formated HTML
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Re: highlight_string()

Post by AKA Panama Jack »

nwp wrote:highlight_string() Prints the highlighted string but i wanna do like this

Code: Select all

$str = highlight_string($line);
e.g. $str will hold the formated HTML
You might want to check the PHP documentation.

Code: Select all

$str = highlight_string($line, true);
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

The manual entry provides some valuable insight

(Hint: look at the second, optional parameter)

edit: too quick on your feet, panama jack :wink:
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

First time for everything. :twisted:
nwp
Forum Contributor
Posts: 105
Joined: Sun Feb 04, 2007 12:25 pm

Post by nwp »

OK Thanks It working with true argument. But ho wcan I highlight HTML sorce code
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

There is no built-in PHP function, but you could try a third party syntax highlighter like Geshi.
nwp
Forum Contributor
Posts: 105
Joined: Sun Feb 04, 2007 12:25 pm

Post by nwp »

aaronhall wrote:There is no built-in PHP function, but you could try a third party syntax highlighter like Geshi.
Whats Geshi ??
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Google it.
Post Reply