When I use the ip2long function in a class, it does not return a valid result. If I call the function outside of the class, as shown, it returns a valid result. But if I use the class, the conversion is ignored. So I assume the problem is with the class but don't know what that is. Would someone please point out my mistake, please?
echo ip2long('1.0.1.10'); //gives 16777482
$ip_checker = new ip_checker;
echo $ip_checker->CheckIP('1.0.1.10'); //gives 1.0.1.10
class ip_checker {
public function __construct() {
}
public function CheckIP($ip) {
$ip = ip2long($ip);
return $ip;
}
}