RE: [PHP] Everything between something becomes an array element

From: Date: Tue, 06 Nov 2001 07:57:32 +0000
Subject: RE: [PHP] Everything between something becomes an array element
Groups: php.general 
Request: Send a blank email to php-general+get-73556@lists.php.net to get a copy of this message
Here is right implememtation of all i see <? $co=0; $str="<tr><td><table><tr><td>foo</td><td>bar</td></tr></table></tr>"; echo "<pre>"; GetTagElements($str); echo "</pre>"; function GetTagElements($str) { global $co; if ($co++){echo "tag[".($co-1)."]= ".htmlentities($str)."<br>";} $how=preg_match_all('~\<tr\>(.*)<\/tr\>~',$str,$var_match,PREG_SET_ORDER); if ($how) for ($i=1;$i<count($vr=$var_match[0]);$i++) { GetTagElements($vr[$i]); } else return 0; } ?> > -----Original Message----- > From: Andrey Hristov [mailto:andy@icygen.com] > Sent: Monday, November 05, 2001 11:13 PM > To: php-general@lists.php.net > Subject: Re: [PHP] Everything between something becomes an array element > > > Sorry > > $how=preg_match_all('|\<tr>(.*?)</tr\>|',$the_big_string,$matches, > PREG_SET_O > RDER); > > is the correct I think > > Excuses > > > On Monday 05 November 2001 08:57 am, you wrote: > > It gives me an error....: > > > > Warning: Compilation failed: nothing to repeat at offset 7 in > > c:\www\innocenti\teste.php on line 17 > > > > I think that 'offset' is like a letter from the regex, but I > could not fix > > it... >

« previous php.general (#73556) next »