4 Replies - 1981 Views - Last Post: 10 October 2009 - 04:33 PM Rate Topic: -----

#1 kyle4404  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 10-August 09

Need to reformat a phone number so skype will recognize it on a mac

Post icon  Posted 10 August 2009 - 09:20 AM

I am calling a phone number variable that is stored in my database and it is formatted with a "." separating the numbers. ie: 555.555.5555

When I echo this variable on a web site one of the macs I am using doesn't allow you to click on the number while the xp machine does. I am thinking I just need to reformat the string to make it something the mac can understand. I tried using str_replace to replace the "." with "-" but I get the same problem.

$ActivevPhone is the variable for the phone number I am echoing.


How would I go about doing this?

Thanks in advance!

Is This A Good Question/Topic? 0
  • +

Replies To: Need to reformat a phone number so skype will recognize it on a mac

#2 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,604
  • Joined: 20-January 09

Re: Need to reformat a phone number so skype will recognize it on a mac

Posted 10 August 2009 - 09:31 AM

Interesting that str_replace doesn't work, you could do substr and get all the different elements.

$phoneNum = "907.569.0505"
$areacode = substr($phoneNum, 0,3);
$exch = substr($phoneNum,4,3);
$num = substr($phoneNum,8,4);
$phoneNum = $areacode . "-" . $exch . "-" . $num;



You could also use explode using periods, but I think the above method is cleaner. I am sure there is a preg_replace, but I am not too skilled at regex to help you with that.

--

Greg
Was This Post Helpful? 0
  • +
  • -

#3 kyle4404  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 10-August 09

Re: Need to reformat a phone number so skype will recognize it on a mac

Posted 10 August 2009 - 11:19 AM

Had to tweak it a little bit but what you gave me worked! Apparently the mac has to have the number formatted like (555) 555-5555 in order for skype to recognize it on a website, in order to be clickable. Just made that simple modification and it worked perfectly! Thanks a lot!
Was This Post Helpful? 0
  • +
  • -

#4 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,604
  • Joined: 20-January 09

Re: Need to reformat a phone number so skype will recognize it on a mac

Posted 10 August 2009 - 11:26 AM

No probs.
Was This Post Helpful? 0
  • +
  • -

#5 willchen298  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-October 09

Re: Need to reformat a phone number so skype will recognize it on a mac

Posted 10 October 2009 - 04:33 PM

str_replace(".", "-", $ActivevPhone)

View Postkyle4404, on 10 Aug, 2009 - 08:20 AM, said:

I am calling a phone number variable that is stored in my database and it is formatted with a "." separating the numbers. ie: 555.555.5555

When I echo this variable on a web site one of the macs I am using doesn't allow you to click on the number while the xp machine does. I am thinking I just need to reformat the string to make it something the mac can understand. I tried using str_replace to replace the "." with "-" but I get the same problem.

$ActivevPhone is the variable for the phone number I am echoing.


How would I go about doing this?

Thanks in advance!

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1