title: How to declare an associative array in PHP using array()?
body: <p>This is giving php warning</p>
  
  <pre><code>&lt;?php
  $xml = simplexml_load_file("videos.xml") or die("Error: Object creation 
  Failed");
  $videos = array();
  
  foreach( $xml-&gt;children() as $video){
     $a= $video-&gt;Serial;
     $b=$video-&gt;URI;
     $videos[$a] = $b;
  }
  
  header('Content-type: application/json');
  echo json_encode($videos);
  ?&gt;
  </code></pre>
  
  <p>Illegal offset type in line 8. How to Fix it ?</p>