Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
This one is difficult to explain.
I want to use preg_replace() to replace symbols that's not inside <> and [] to <span class="symbol">{symbol}</span>
IE:
[quote]Hello, do you use <a href="http://www.google.com">Google?</a>[/quote]
will be replaced with[quote]Hello<span class="symbol">,</span> do you use <a href="http://www.google.com">Google<span class="symbol">?</span></a>[/quote]
Right now my code is:Code: Select all
function replacesymbols($var)
{
$hl = array("(",")","!","?","-","_","+","*","'",".",",",":",";","^","~","$","%","#","@");
for ($i=0; $i<count($hl); $i++) $var = str_replace($hl[$i], "<span class=\"symbol\">".$hl[$i]."</span>", $var);
return $var;
}Anyone have a clue?
feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]