kellan4459 Posted January 31, 2012 Share Posted January 31, 2012 I am trying to split a simple string from my db it is in the format #/# 1/5 2/5 3/3 4/2 etc... I have the following: echo $value.'<BR>'; $temp=explode('/',$value['field']); print_r($temp); echo '<br>'; when I execute the above (it's in a for loop) I get the following output 1/5 Array ( [0] => 1 ) 2/5 Array ( [0] => 2 ) 3/3 Array ( [0] => 3 ) 4/2 Array ( [0] => 4 ) I am expecting 1/5 Array ( [0] => 1 [1] => 5) for the first entry and so on down the line showing both values after the explode. Link to comment https://forums.phpfreaks.com/topic/256133-tempexplodevaluefieldname-only-giving-one-value/ Share on other sites More sharing options...
Andy-H Posted January 31, 2012 Share Posted January 31, 2012 Why are you exploding $value['field'] ? the echo $value gives the correct output so explode that. Link to comment https://forums.phpfreaks.com/topic/256133-tempexplodevaluefieldname-only-giving-one-value/#findComment-1313042 Share on other sites More sharing options...
litebearer Posted January 31, 2012 Share Posted January 31, 2012 please show more of your code Link to comment https://forums.phpfreaks.com/topic/256133-tempexplodevaluefieldname-only-giving-one-value/#findComment-1313043 Share on other sites More sharing options...
kellan4459 Posted January 31, 2012 Author Share Posted January 31, 2012 Thanks Andy H That was it Link to comment https://forums.phpfreaks.com/topic/256133-tempexplodevaluefieldname-only-giving-one-value/#findComment-1313046 Share on other sites More sharing options...
Andy-H Posted January 31, 2012 Share Posted January 31, 2012 No problem Link to comment https://forums.phpfreaks.com/topic/256133-tempexplodevaluefieldname-only-giving-one-value/#findComment-1313047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.