greenba Posted March 17, 2009 Share Posted March 17, 2009 Hello, I have the following string $som_str = "(090316211923BP05000013912345678090316A4510.9511N01548.2855E000.02119239.890010000000L000000)" What I need is to extract data from it so from this example I would get $data1 = "4510.9511" $data2= "01548.2855" ($data1 is the value btwletters A and N, and $data2 is btw N and E) Any ideas? Regards, Quote Link to comment https://forums.phpfreaks.com/topic/149816-solved-extract-data-from-string/ Share on other sites More sharing options...
premiso Posted March 17, 2009 Share Posted March 17, 2009 <?php $string = "(090316211923BP05000013912345678090316A4510.9511N01548.2855E000.02119239.890010000000L000000)"; list($first, $second) = explode("N", $string); list(, $data1) = explode("A", $first); list($data2) = explode("E", $second); echo "Data1: {$data1} and Data2: {$data2}<br />"; ?> explode and list. Quote Link to comment https://forums.phpfreaks.com/topic/149816-solved-extract-data-from-string/#findComment-786723 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.