Mega Code Archive
Categories
/
Php
/
Strings
Match an IP address
$test = "156.152.55.35"; if ( preg_match( "/(\d+)\.(\d+)\.(\d+)\.(\d+)/", $test, $array ) ) { print "
\n"; print_r( $array ); print "
\n"; } ?>