note 25583 deleted from function.is-numeric by didou
| From: | didou@php.net | Date: | Sun, 18 May 2003 10:19:11 +0000 |
| Subject: | note 25583 deleted from function.is-numeric by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48502@lists.php.net to get a copy of this message | ||
Note Submitter: clawz@vcn.bc.ca
----
IP Checking, removes the 0's on the left.
<?php
$ip = "040.140.040.140";
list($one,$two,$three,$four)= split ("\.",$ip);
$one = ltrim($one,"0");
$two = ltrim($two,"0");
$three = ltrim($three,"0");
$four = ltrim($four,"0");
$ip = "$one.$two.$three.$four";
printf("$ip");
?>
Input IP: 040.140.040.140
Output IP: 40.140.40.140