Help with a PHP script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jenko
Forum Newbie
Posts: 1
Joined: Mon Sep 16, 2013 4:23 pm

Help with a PHP script

Post by jenko »

Hello all, I am a beginner at scripting but need this done for a personal project.

My aim is to make a website, with two input boxes, users will then enter two co-ordinates: "571837.62N" AND "0021601.95W"

Then the website will convert the two inputed coordinates to the following output format "N057.18.37.620 W002.16.01.950".

Can anyone provide me with a code for this?

Many thanks in advanced. :)
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Help with a PHP script

Post by requinix »

If your users have to type the numbers in anyways, can't you just make them type it in the slightly different format that you want? Seriously, it's just a couple added periods with the letter moved.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Help with a PHP script

Post by Christopher »

Use the substr() function to check and extract substrings in the input strings. Concatenate the parts back together.
(#10850)
Post Reply