title: PHP json encode error in Javascript
body: <p>I'm having the following error on an HTML page.</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: page URL Here
    Unexpected token ;</p>
  </blockquote>
  
  <p>This is the code (variables are defined elsewhere and do exist.</p>
  
  <pre><code>&lt;script&gt;
      statesDropDown = &lt;?php echo json_encode($this-&gt;states);?&gt;;
      programIdsDropDown = &lt;?php echo json_encode($this-&gt;programIdsData);?&gt;;
  &lt;/script&gt;
  </code></pre>
  
  <p>This is the results of the above on the page</p>
  
  <pre><code>&lt;script&gt;
      statesDropDown = [{"id":"1","code":"AL","name":"Alabama"},{"id":"2","code":"AK","name":"Alaska"},{"id":"3","code":"AZ","name":"Arizona"},{"id":"4","code":"AR","name":"Arkansas"},{"id":"5","code":"CA","name":"California"},{"id":"6","code":"CO","name":"Colorado"},{"id":"7","code":"CT","name":"Connecticut"},{"id":"8","code":"DE","name":"Delaware"},{"id":"9","code":"FL","name":"Florida"},{"id":"10","code":"GA","name":"Georgia"},{"id":"11","code":"HI","name":"Hawaii"},{"id":"12","code":"ID","name":"Idaho"},{"id":"13","code":"IL","name":"Illinois"},{"id":"14","code":"IN","name":"Indiana"},{"id":"15","code":"IA","name":"Iowa"},{"id":"16","code":"KS","name":"Kansas"},{"id":"17","code":"KY","name":"Kentucky"},{"id":"18","code":"LA","name":"Louisiana"},{"id":"19","code":"ME","name":"Maine"},{"id":"20","code":"MD","name":"Maryland"},{"id":"21","code":"MA","name":"Massachusetts"},{"id":"22","code":"MI","name":"Michigan"},{"id":"23","code":"MN","name":"Minnesota"},{"id":"24","code":"MS","name":"Mississippi"},{"id":"25","code":"MO","name":"Missouri"},{"id":"26","code":"MT","name":"Montana"},{"id":"27","code":"NE","name":"Nebraska"},{"id":"28","code":"NV","name":"Nevada"},{"id":"29","code":"NH","name":"New Hampshire"},{"id":"30","code":"NJ","name":"New Jersey"},{"id":"31","code":"NM","name":"New Mexico"},{"id":"32","code":"NY","name":"New York"},{"id":"33","code":"NC","name":"North Carolina"},{"id":"34","code":"ND","name":"North Dakota"},{"id":"35","code":"OH","name":"Ohio"},{"id":"36","code":"OK","name":"Oklahoma"},{"id":"37","code":"OR","name":"Oregon"},{"id":"38","code":"PA","name":"Pennsylvania"},{"id":"39","code":"RI","name":"Rhode Island"},{"id":"40","code":"SC","name":"South Carolina"},{"id":"41","code":"SD","name":"South Dakota"},{"id":"42","code":"TN","name":"Tennessee"},{"id":"43","code":"TX","name":"Texas"},{"id":"44","code":"UT","name":"Utah"},{"id":"45","code":"VT","name":"Vermont"},{"id":"46","code":"VA","name":"Virginia"},{"id":"47","code":"WA","name":"Washington"},{"id":"48","code":"WV","name":"West Virginia"},{"id":"49","code":"WI","name":"Wisconsin"},{"id":"50","code":"WY","name":"Wyoming"}];
      programIdsDropDown = ;
  &lt;/script&gt;
  </code></pre>
  
  <p>I've removed the encode and confirm that I get a cannot convert array to string error.  Why is this returning blank here and causing the before mentioned error?</p>
  
  <p>This is code that was moved from a 2012 Windows Server to a 2008 Windows Server and ran completely fine in 2012.  Are there any known issues with this JS call in 2008?  This is used within AngularJS but at this point of error is independent of the AngularJS so is just basic JS/PHP.</p>
  
  <p>Many thanks.</p>