urban Posted April 4, 2009 Share Posted April 4, 2009 i have this 52.88239122226187, -0.3515625 how do i split this from the "," into an array xcords[ycords] Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted April 4, 2009 Share Posted April 4, 2009 explode it on the , $string="52.88239122226187, -0.3515625"; $string_exp=explode(",", $string); $coord=array( 'xcoord'=>$string_exp[0], 'ycoord'=>$string_exp[1] ); Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 4, 2009 Share Posted April 4, 2009 Do it this way: <?php $xy=array(); $string="52.88239122226187, -0.3515625"; list($xy['xcoord'],$xy['ycoord']) = explode(',',$string); echo '<pre>' . print_r($xy,true) . '</pre>'; ?> Ken Quote Link to comment 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.