Well...it is a challenge for me atleast. Here is what I would like to do:
I am writing a preg_replace function that does a little vBulletin code to HTML work. Here is the kicker...a portion of the resulting string needs to be run through a PHP function that we wrote...
For example:
[elink=Google]http://www.google.com[/elink]
Will need to turn into:
<a href="http://www.ourdomain.com/redirect.php?link=base64_encode($link)">Google.com</a>
So, the preg_replace needs to run the base64_encode function to encode the destination URL and then place it into an HTML URL.
Here is what I have so far:
$lazy_code = preg_replace("/\[elink=(.+?)\](.+?)\[\/elink\]/", "<a href=http://www.ourdomain.com/redirect.php?link=".base64_encode($2).">$1</a>", $source_code);
This results in a PHP error.
Any ideas? Really appreciate the help.
Peter