title: Getting error in PHP 5.3 which works in php 5.4
body: <p>Here is the line which gave me error in PHP 5.3 which runs perfectly in php 5.4</p>
  
  <pre><code>if ($user-&gt;getGeoCode()) { 
      $latitude = $user-&gt;getGeoCode()['latitude'];
  }
  </code></pre>
  
  <p>The error message is :</p>
  
  <pre><code>Parse error: syntax error, unexpected '[' in IndexController.php on line 29
  </code></pre>
  
  <p>Here is my user class:</p>
  
  <pre><code> class User {
     .....
    public function getGeoCode() {
      $geoCode=array();
      if ($this-&gt;getAddress() &amp;&amp; $this-&gt;getCity() &amp;&amp; $this-&gt;getCountry()) {
          $address = urlencode($this-&gt;getAddress() . ' ' . $this-&gt;getCity() . ' ' . $this-&gt;getPostalCode() . ' ' . $this-&gt;getCountry()-&gt;getName());
          $geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address=' . $address . '&amp;sensor=false');
          $output = json_decode($geocode);
          if ($output-&gt;status=='OK') {
              $geoCode['latitude']=$output-&gt;results[0]-&gt;geometry-&gt;location-&gt;lat;
              $geoCode['longitude']=$output-&gt;results[0]-&gt;geometry-&gt;location-&gt;lng;
              return $geoCode;
          }
          else {
              return null;
          }
       }
       else {
          return null;
       }
     }
   }
  </code></pre>
  
  <p>Is this error related to version of PHP ?</p>