Jump to content

[SOLVED] Strip a 0 from a mobile number and add 44 instead?


cr-ispinternet

Recommended Posts

Hi All,

 

been toying with this for a while, but i need to do this

because its affecting the sending of sms thorugh an sms gateway

 

i need to be able to replace the 0 from $mobile_number with a 44

so basically well end up with this..

 

Original mobile: 07832128624

 

after str_replace or something like that 447832128624

 

had a quick go with it using str_replace and could get it to output

thanks to any who can show me how to sort it.

 

Alan

Link to comment
Share on other sites

What happens if there's a 0 in the middle of the number? You'd get 44's throughout the number, in places that you don't want them to be.

 

To take care of this problem, something like this will do the trick nicely:

 

<?php
$mobile_number = "07832128604";
$mobile = preg_replace("/^0(.*)/", "44\\1", $mobile_number);

print $mobile;
?>

Link to comment
Share on other sites

As you said :-)

 

this was from my log, my own mobile number has a 0 further down

can you do me a favour and explain exactly what u have done addding the extra bits in

i really appreciate the help with that i think its saved my platform :-) had to many sms messages

nto getting delivered and this is the only thing i can think of :-)

 

Alan

 

<-------------- New Campaign Check Start [2008-01-05 09:07] Send Sms Delayed ------------->

[2008-01-05 09:07] QUERY: SELECT * from sms_delayed_campaigns where approved='Y' and processed='N' and processing='0' and sms_type='delayed' LIMIT$

[2008-01-05 09:07] DATE AND TIME: Sending Date and Time is 2008-01-05 & 08:10

[2008-01-05 09:07] CURRENT TIME AND DATE: Current time is 09:07 and current date is 2008-01-05

[2008-01-05 09:07] QUERY: SELECT * from sms_delayed_campaigns where '2008-01-05' <= '2008-01-05' and '08:10' <= '09:07' and approved= 'Y' and proc$

[2008-01-05 09:07] PROCESSING: Updating Campaigns Database Processing=1

 

--> Sending to 4477253447138 SESSION ID: 9057780a67dd955d725d5dfe92df890a

 

[2008-01-05 09:07] SUCCESS ID:  e151190c557c6e3f59c6438aab4cb5b0[2008-01-05 09:07] PROCESSING: Updating Campaigns Database Processing=0

[2008-01-05 09:07] PROCESSING SMS: Updated Processing field to Y in sms_delayed_campaigns

[2008-01-05 09:07] FROM: Smooth

[2008-01-05 09:07] TITLE: testing instant logs

[2008-01-05 09:07] MESSAGE: some message here!

[2008-01-05 09:07] QUERY: SELECT * FROM members WHERE mobile_number LIKE '07725307138' AND member_status= 'Full'

<-------------- New Campaign Check Finish [2008-01-05 09:07] Send Sms Delayed ------------->

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.