dt192 Posted November 10, 2008 Share Posted November 10, 2008 ok i have used preg_match_all before just fine but for some reason it just refuses to work for me tonight, i am just using it to grab a couple of values from some xml see example: <entry> <published>2008-11-08T15:12:41Z</published> <content type="html">bla bla bla</content> </entry> and what i want to be output is: <div>2008-11-08T15:12:41Z</div> <div>bla bla bla</div> <div>2008-11-08T17:14:44Z</div> <div>bla2 bla2 bla2</div> <div>2008-11-08T19:12:30Z</div> <div>bla bla bla</div> now i know both values can be grabbed at the same time via preg_match_all and are stored to an array but i just cant do it today lol so please help thanx Link to comment https://forums.phpfreaks.com/topic/132088-solved-please-make-php-preg_match_all-work-for-me-cries/ Share on other sites More sharing options...
Jeremysr Posted November 10, 2008 Share Posted November 10, 2008 PHP has an XMLReader that can be used to easily read XML. I think that would be a much better choice for this. Link to comment https://forums.phpfreaks.com/topic/132088-solved-please-make-php-preg_match_all-work-for-me-cries/#findComment-686505 Share on other sites More sharing options...
ddrudik Posted November 10, 2008 Share Posted November 10, 2008 <?php $in='<entry> <published>2008-11-08T15:12:41Z</published> <content type="html">bla bla bla</content> </entry>'; $out=preg_replace('#<entry> <published>([^<]*)</published> <content type="html">([^<]*)</content> </entry>#','<div>$1</div> <div>$2</div>',$in); echo $out; ?> Link to comment https://forums.phpfreaks.com/topic/132088-solved-please-make-php-preg_match_all-work-for-me-cries/#findComment-686702 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.