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