cooldude832 Posted December 2, 2007 Share Posted December 2, 2007 I'm trying to explode some stuff at the "<" character so I do $temp = explode("<",$string); but it ain't ripping apart the tags as I expected is it cause there is no space? Link to comment https://forums.phpfreaks.com/topic/79879-explode-aint-exploding-as-expected/ Share on other sites More sharing options...
GingerRobot Posted December 2, 2007 Share Posted December 2, 2007 Damn, i think i lent Barand my mind reader chip from my computer again. Perhaps showing us some sample text in $string might help? Oh, and perhaps defining 'as i expected' would be useful too. Link to comment https://forums.phpfreaks.com/topic/79879-explode-aint-exploding-as-expected/#findComment-404471 Share on other sites More sharing options...
cooldude832 Posted December 2, 2007 Author Share Posted December 2, 2007 I just str_replaced the "<", " < " and got the results I expected so in conclusion explode matches whole word matches so to speak Link to comment https://forums.phpfreaks.com/topic/79879-explode-aint-exploding-as-expected/#findComment-404474 Share on other sites More sharing options...
GingerRobot Posted December 2, 2007 Share Posted December 2, 2007 Im afraid your conclusion is incorrect. <?php $str = 'text<moretext'; foreach(explode('<',$str) as $v){ echo $v.'<br />'; } ?> Produces exactly the same as: <?php $str = 'text < moretext'; foreach(explode('<',$str) as $v){ echo trim($v).'<br />'; } ?> Link to comment https://forums.phpfreaks.com/topic/79879-explode-aint-exploding-as-expected/#findComment-404483 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.