note 51198 rejected from function.preg-replace by nlopess

From: Date: Thu, 24 Mar 2005 23:28:20 +0000
Subject: note 51198 rejected from function.preg-replace by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-86919@lists.php.net to get a copy of this message
Note Submitter: doron88 at gmail dot com ---- Hello all php experts :), I have a little question: I have a string, want to highlight all php codes from this string, how shall I do it? that's my code: <?php function phpcode($string) //finds and highlight php codes from the string { return preg_replace('!\[PHP\]\s*(.*?)\s*\[\/PHP\]!i', '<br />PHP Code:<p dir="ltr">'. highlight_string('$1',TRUE). '</p>', $string); ?>

« previous php.notes (#86919) next »