Re: IPv6 validation

From: Date: Sat, 12 Jul 2008 15:18:00 +0000
Subject: Re: IPv6 validation
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-276690@lists.php.net to get a copy of this message
On Sat, Jul 12, 2008 at 9:13 AM, Bernhard Kohl <bk@myhich.com> wrote: > Doesnt filter_var() require PHP5+ ? > > I have quite some systems still running 4.4.8. > > On 7/12/08, Kevin Waterson <kevin@phpro.org> wrote: >> >> This one time, at band camp, Yeti <yeti@myhich.com> wrote: >> >> > Now i was wondering of what there might be the best way to validate an >> IPv6 >> > address. >> >> >> from this url.. >> http://phpro.org/tutorials/Filtering-Data-with-PHP.html#9 >> >> <?php >> >> /*** an IP address ***/ >> $ip = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334"; >> >> /*** try to validate as IPV6 address ***/ >> if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE) >> { >> echo "$ip is not a valid IP"; >> } >> else >> { >> echo "$ip is valid"; >> } >> ?> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > PHP4 has been deprecated forever now. Step up to the plate and get with 5, especially if you're still writing new code.

« previous php.general (#276690) next »