note 86496 modified in function.gethostbyaddr by felipe

From: Date: Wed, 22 Oct 2008 12:45:39 +0000
Subject: note 86496 modified in function.gethostbyaddr by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145582@lists.php.net to get a copy of this message
Here is a simple function I compiled from user-notes that works great.. any improvements? <?php function get_ip( $host ){ $hostip = @gethostbyname( $host ); $ip = ( $hostip == $host ) ? $host : long2ip( ip2long( $hostip ) ); //echo sprintf("Resolved %s to %s", $host, $ip); return $ip; } ?> --was-- Here is a simple function I compiled from user-notes that works great.. any improvements? function get_ip( $host ){ $hostip = @gethostbyname( $host ); $ip = ( $hostip == $host ) ? $host : long2ip( ip2long( $hostip ) ); //echo sprintf("Resolved %s to %s", $host, $ip); return $ip; } http://php.net/manual/en/function.gethostbyaddr.php

« previous php.notes (#145582) next »