php conditional isn't working
<p>I have a strange problem. My conditional isn't working:</p>

<pre><code>$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://maps.googleapis.com/maps/api/geocode/json?    address='.urlencode($address).'&amp;sensor=true');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($ch);
curl_close ($ch);

if($result !== null) {
    $result = @json_decode($result, true);
    $result = @$result['results'][0]['address_components'];

    foreach($result as $key =&gt; $value) {
        if($value['types'][0] == 'administrative_area_level_2')
            return $value['long_name'];
    }
} else {
    throw new Exception('unable to look up the county');
}
</code></pre>

<p>I tried </p>

<pre><code>if($result)
if($result != null)
if($result != '')
if(!empty($result))
if(isset($result))
</code></pre>

<p>neither one worked, script always goes inside the block, but the value of $result is null, I can see it through xdebug.
Why is this happening?</p>

<p>edit:
here's a screenshot
<img src="http://i.stack.imgur.com/X0hQv.jpg" alt="screenshot"></p>

<p>here's what var_dump shows:</p>

<blockquote>
  <p>string '{    "results" : [],    "status" : "ZERO_RESULTS" } '
  (length=52)</p>
</blockquote>

<p>This fixed it:</p>

<pre><code>        $result = @json_decode($result, true);

    if(!empty($result['results'])) {
</code></pre>
