Re: modifying a substring

From: Date: Tue, 27 Apr 2004 03:32:25 +0000
Subject: Re: modifying a substring
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-23557@lists.php.net to get a copy of this message
William Candillon wrote:
Use xml_parse_into_struct () : <? $string = Ur_contents $ xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $string, $ vals, $ index); xml_parser_free($xml_parser); highlight_string($vals['0']['value']); ?>
I was going to suggest preg_replace, but I kind of like xml_parse_into_struct(). But, won't they have a problem if there's no root tags wrapping the entire string?
To show the code out the <code></code> : <? $string = Ur_contents $i = 1; $fp = fread($string, $i); While (eregi("<code>", $fp)== false) { ++$i $fp = fread($string, $i); } $txt = substr ($fp, -6); Echo ($txt); ?>


« previous php.windows (#23557) next »