Strip leading zero ?

Soldato
Joined
19 Apr 2003
Posts
2,529
I've bodged together a script, a page opens a pop up box and inserts a phone number into the 'to' box.

I need to strip the leading 0 and add +44, how do I strip the 0 ?

Code:
<tr><td><b>SMS to</b></td><td><input type="text" name="to" value="+44<?PHP echo $OUT;?>"></td></tr>
 
Code:
<tr>
 <td>
   <b>SMS to</b>
 </td>
 <td>
  <input type="text" name="to" value="<?=str_replace("0","+44",$OUT)?>"/>
 </td>
</tr>
 
oops, never thought of that!

Code:
<tr>
 <td>
   <b>SMS to</b>
 </td>
 <td>
  <input type="text" name="to" value="<?="+44".ltrim($OUT,"0")?>"/>
 </td>
</tr>
 
Back
Top Bottom