View Single Post
Old 01-18-2008, 05:50 PM   #6 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

json_encode will never return a boolean. If you previously check that the $szContent cannot be FALSE then you might consider it ok to check to see if json_encode returns string "false".

However, if you pass in a non-encodable value (e.g. a resource) the return string won't be "false" but will instead be (string) "null" with an E_WARNING error ([json] (json_encode_r) type is unsupported, encoded as null.).

Depending on your specific scenario, simply checking for string "false" might suffice.
Salathe is offline  
Reply With Quote