Hi Everyone,
How can I add a + sign to the following string.... for some reason I just can not figure it out
I have tried ".+
and ".+."
and sign quotes - both options but it just doesnt seem to work for me....

$number = $Code."".substr( $mobnum, 0 );

So, number will be the international code of the country plus the sms text message
for example 4401234567890 for UK numbers
but for international numbers I am trying to add the + sign
So it reads +11234567890 for the US...

Hope someone can help & explain where I am going wrong

5 Years
Discussion Span
Last Post by LastMitch

If you're just looking to add a plus sign at the beginning of a sequence of numbers, then it's as simple as the following:

$number = 1234567890;
$complete_number = "+" . $number;

Just ensure the + sign is inside the quotation marks.

Sorry if that's not what you're looking for, it's hard to tell from your code since I don't know the values of the variables.



Hope someone can help & explain where I am going wrong

You didn't do anything wrong. It's just that + sign is to used for international call. It's pretty expensive.

Instead of this ".+ or this ".+." used "{+}"

Try this:

    $number = $Code."{+}".substr( $mobnum, 0 );
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.