PHP Match Ip Address – String Function

<?
$test = "156.152.55.35";
if ( preg_match( "/(\d+)\.(\d+)\.(\d+)\.(\d+)/", $test, $array ) ) {
  print "<pre>\n";
  print_r( $array );
  print "

\n”;
}
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.