ted_chou12 Posted December 25, 2006 Share Posted December 25, 2006 hey, i got it ;D suddenly remembered... explode explodes everything... ;)[code]<?php$position = "N18 23.5725 W66 23.8565";$ex1 = explode(" ",$position); $number1 = ($ex1[1]/60);if (substr($ex1[0], 0, 1) == "N"){$answer1 = $number1 + substr($ex1[0], 1, 3);}if (substr($ex1[0], 0, 1) == "W"){$answer1 = 0 - ($number1 + substr($ex1[0], 1, 3));} $number2 = ($ex1[3]/60);if (substr($ex1[2], 0, 1) == "N"){$answer2 = $number2 + substr($ex1[2], 1, 3);}if (substr($ex1[2], 0, 1) == "W"){$answer2 = 0 - ($number2 + substr($ex1[2], 1, 3));}echo "$answer1 and $answer2";?>[/code] Link to comment https://forums.phpfreaks.com/topic/31833-solved-converting-a-latlon-coordinate/page/2/#findComment-147645 Share on other sites More sharing options...
ERuiz Posted December 25, 2006 Author Share Posted December 25, 2006 WOOOHOOOO!!!!! YOU GOT IT!!!! THANKS A MILLION! ;D ;D ;D ;DShould I even ask for one last thing? hahahahaha I need for each result to be trimmed down to only 4 decimal places. ;) Link to comment https://forums.phpfreaks.com/topic/31833-solved-converting-a-latlon-coordinate/page/2/#findComment-147647 Share on other sites More sharing options...
ted_chou12 Posted December 25, 2006 Share Posted December 25, 2006 thats easy :D hold on Link to comment https://forums.phpfreaks.com/topic/31833-solved-converting-a-latlon-coordinate/page/2/#findComment-147648 Share on other sites More sharing options...
ted_chou12 Posted December 25, 2006 Share Posted December 25, 2006 [code]<?php$position = "N18 23.5725 W66 23.8565";$ex1 = explode(" ",$position); $number1 = ($ex1[1]/60);if (substr($ex1[0], 0, 1) == "N"){$answer1 = $number1 + substr($ex1[0], 1, 3);}if (substr($ex1[0], 0, 1) == "W"){$answer1 = 0 - ($number1 + substr($ex1[0], 1, 3));} $number2 = ($ex1[3]/60);if (substr($ex1[2], 0, 1) == "N"){$answer2 = $number2 + substr($ex1[2], 1, 3);}if (substr($ex1[2], 0, 1) == "W"){$answer2 = 0 - ($number2 + substr($ex1[2], 1, 3));}$dp1 = round($answer1,4);$dp2 = round($answer2,4);echo "$dp1 and $dp2";?>[/code]sorry, you cant have numbers before letters for variable mybad. Link to comment https://forums.phpfreaks.com/topic/31833-solved-converting-a-latlon-coordinate/page/2/#findComment-147649 Share on other sites More sharing options...
ERuiz Posted December 25, 2006 Author Share Posted December 25, 2006 SIMPLY AMAZING!!!! What an experience this has been, buddy! I am grateful for all your help. Kudos to you!Regards,Efrain Ruiz Link to comment https://forums.phpfreaks.com/topic/31833-solved-converting-a-latlon-coordinate/page/2/#findComment-147651 Share on other sites More sharing options...
ted_chou12 Posted December 25, 2006 Share Posted December 25, 2006 welcome, ive also had a good time figuring out.. i enjoy math problems even mroe doing them on computers.. :D Link to comment https://forums.phpfreaks.com/topic/31833-solved-converting-a-latlon-coordinate/page/2/#findComment-147652 Share on other sites More sharing options...
ERuiz Posted December 25, 2006 Author Share Posted December 25, 2006 I hate math! hahahaha Link to comment https://forums.phpfreaks.com/topic/31833-solved-converting-a-latlon-coordinate/page/2/#findComment-147653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.