title: Parse error with PHP json_encode
body: <p>I'm getting an odd error and I'm not sure why it's happening. I'm trying to send multiple values to my ajax call which is resulting in <code>undefined</code>.</p>
  
  <p>I tried to debug it and I realized that my PHP is getting a parse error with my <code>json_encode</code>. The reason seems to be with the passing of multiple values. Can anyone explain why is that so?</p>
  
  <pre><code>&lt;?php
  ini_set('display_errors', 1);
  error_reporting(E_ALL);
  
  $files = glob("images/*.*");
  
  for ($i=0; $i&lt;count($files); $i++) {
      $image = $files[$i];
  }
  
  echo json_encode("array_of_images" =&gt; $files, "size_of_array" =&gt; sizeof($files));
  ?&gt;
  </code></pre>
  
  <p><strong>Update: Ajax Code</strong></p>
  
  <pre><code>&lt;script&gt;
      $.ajax({    //create an ajax request to load_page.php
          type: "GET",
          url: "img.php",             
          dataType: "html",   //expect html to be returned                
          success: function(response){     
              alert(response.array_of_images);
              alert(response.size_of_array);
          },
          error:function (xhr, ajaxOptions, thrownError){
             // alert(thrownError);
          }
      });
  &lt;/script&gt;
  </code></pre>