Possible duplicate:
json_encode returns NULL?
I am having a strange problem with json_encode()in php. Pretty simple code:
$content = json_encode(array('content1' => $arm_length,
'content2' => $body_length));
echo $content;
$arm_lengthand $body_lengthcontain HTML markup for the two drop-down menus. My problem is what echoshows NULLfor content1and content2. If I clean json_encode()and just do it print_r($content), it will display all the data as it should be.
Does anyone know what is going on here? Is there certain data that cannot be parsed in JSON? I have done this several times using Ajax / PHP and have never experienced any problems.
Cheers for any help with this.
source
share