I have the following code with a rather odd behaviour: <html><head><title>Test></title></head><body> <?php $string='This is some text which will eventually need to be split<p> Hopefully it gets done here</p><p> I would like that very much</p> <p>but whether it will happen or not</p> <p>is difficult to say.</p>'; $Xarray=preg_split('/(?=<p>)/',$string,-1, 'SPLIT_DELIM_CAPTURE'); $count=count($Xarray); for ($i=0;$i < $count;){ print $Xarray[$i]; //print $i; $i++; } ?> </body></html>
The behaviour is that on the last '<p>' delimiter that is supposed to be returned instead returns 'p>', leaving of the first '<'. Below is the source: <html><head><title>Test></title></head><body> This is some text which will eventually need to be split<p> Hopefully it gets done here</p><p> I would like that very much</p> <p>but whether it will happen or not</p> p>is difficult to say.</p></body></html> This was done as a test to figure out what was going on. I am probably making some stupid newbie mistake, but I have no idea what it is. Any ideas? Best, Nik __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php