title: PHP syntax error, unexpected '[' in using an array
body: <p>I am using this code below :</p>
  
  <pre><code>$data = array();
  $value = reset($value);
  $data[0] = (string) $value-&gt;attributes()['data'];
  ------^
  </code></pre>
  
  <p>I have no problem in localhost, but in other host, when i check the code, i see this error :</p>
  
  <blockquote>
    <p><strong>Parse error: syntax error, unexpected '[' in</strong> ....</p>
  </blockquote>
  
  <p>I have shown where the code causes error .</p>
  
  <p>i have also used :</p>
  
  <pre><code>$data[] = (string) $value-&gt;attributes()['data'];
  </code></pre>
  
  <p>(without <code>0</code> in <code>[]</code>)</p>
  
  <p>How can i solve it ? </p>