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? Quote 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. Quote 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 Quote 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 />'; } ?> Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.