PHP 5 comes with built in support of JSON format. Function
is bundled in PHP 5.2.0 and takes care of converting PHP arrays into JSON strings, as it is shown in the source of GiveAd.php above.
The users of the previous versions of PHP – such as PHP 4.x can take advantage of JSON.php –
php class implementing JSON.
One of the JSON implementations in PHP 4 is PEAR JSON package.
If you cant use PHP 5.2.0 or greater .
JSON Pear library can be found here: JSON PEAR .
Code changes for inclusion of JSON in PHP 4 are minimal: <?php include_once('JSON.PHP'); $json = new SERVICES_JSON(); ?>
After which you can use the instance of JSON contained in $json variable.
Debugging JSON in PHP scripts
Debugging of server side PHP scripts becomes a challenge when they are called with
Dynamic Script Injection. print() and echo() statements are not very helpful because
the output is not rendered directly in the browser. We looked into using one of the
PHP IDEs and debuggers with JSON in PHP.
Using proper PHP Tools
development with JSON surely opens great possibilities and along with AJAX
leads the way for Web 2.0 PHP applications.