Re: String manipulation

From: Date: Wed, 11 Jun 2003 15:52:42 +0000
Subject: Re: String manipulation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151096@lists.php.net to get a copy of this message
On Wed, 11 Jun 2003 14:53:13 +0100, Marios Adamantopoulos wrote: >[link][title]the >link[/title][address]http://www.php.net[/address][/link] >And I need to change it to this: ><a href="http://www.php.net">the link</a> Ewwww, fun.... try this :) <?PHP $in = '[link][title]the link[/title][address]http://www.php.net[/address][/link]'; $out = preg_replace( "|\[link\]\[title\]([^\[]*)\[/title\]\[address\]([^\[]*)\[/address\]\[/link\]|i", "<a href=\"$2\">$1</a>", $in ); echo "$in<BR>$out" ?>

« previous php.general (#151096) next »