Justin
2013-06-27 22:07:55 UTC
$new_ip = file_get_contents('http://www.ipaddresscheck.comlu.com/ip.php');
And the $old_ip comes from:
$sql = mysql_query('SELECT * FROM ip ORDER BY id DESC LIMIT 1');
$row = mysql_fetch_array( $sql );
$old_ip = $row['current_ip'];
My problem is, I am getting incorrect results from:
if ($old = $new)
{
$different = '1';
}
else {
$different = '2';
}
echo $different;
I ALWAYS get 2, wether the IPs are the same or not; if I use '==' as the comparison, I ALWAYS get 1.
When I run the following code, I get the following output:
var_dump($old_ip);
var_dump($new_ip);
Output
string(15) "123.123.123.123" string(167) "184.6.216.163 "
Are the variables different types? If So, can I make them the same so I am only comparing the IP and not the type? If the IPs are the same I should get '1' and if they are different, I should get '2', right?