<?php $test = "126.122.95.52"; if ( preg_match( "/(\d+)\.(\d+)\.(\d+)\.(\d+)/", $test, $arr ) ) { print "<pre>\n"; print_r( $arr ); print "</pre>\n"; } ?>
Output : Array ( [0] => 126.122.95.52 [1] => 126 [2] => 122 [3] => 95 [4] => 52 )
<?php $test = "126.122.95.52"; if ( preg_match( "/(\d+)\.(\d+)\.(\d+)\.(\d+)/", $test, $arr ) ) { print "<pre>\n"; print_r( $arr ); print "</pre>\n"; } ?>
Output : Array ( [0] => 126.122.95.52 [1] => 126 [2] => 122 [3] => 95 [4] => 52 )
No comments:
Post a Comment