title: json_encode php result is NULL?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1972006/json-encode-is-returning-null">json_encode is returning NULL?</a>  </p>
  </blockquote>
  
  
  
  <p>I'm having a strange problem with <code>json_encode()</code> in php. Pretty simple code:</p>
  
  <pre><code>$content = json_encode(array('content1' =&gt; $arm_length,
                               'content2' =&gt; $body_length));
  echo $content;
  </code></pre>
  
  <p><code>$arm_length</code> and <code>$body_length</code> variables contain the HTML markup for two select dropdown menus. My problem is when it <code>echo</code>'s out it show's <code>NULL</code> for <code>content1</code> and <code>content2</code>. If I take the <code>json_encode()</code> away and just do <code>print_r($content)</code> it shows all the data as it should be. </p>
  
  <p>Does anyone know what's happening here? Is there certain data that can't be parsed into JSON? I've done this a few times now using Ajax/PHP and never had any problems. </p>
  
  <p>Cheers for any help with this.</p>