Json, as a lightweight data interchange format, is starting to get pro-Lai, with the spotlight of XML grabbing sites. Happily, PHP has also built the functionality of JSON-serialized data into functions, making it easy for Phpcoder to use JSON.
In the ointment, the Json_encode/json_decode series function is only above php5.2. This makes determined to develop a compatible PHP system coder very headache.
Fortunately, the JSON approach has already been encapsulated into classes that can be executed by the php4.x series or even lower versions. Thanks first to the pioneer here. So that we can step on the shoulders of giants to success.
Learn more here: http://code.itlearner.com/php/JSON-class.html
How to use:
if (function_exists ("Json_encode"))
{
Return Json_encode ($phparr);
}
Else
{
Require_once ROOT. " Include/json.class.php ";
$json = new Services_json;
Return $json->encode ($phparr);
}