PHP, JSON and JavaScript in Web2.0 Applications - Part 3

Go To Part 2 of PHP, JSON and JavaScript in Web2.0 Applications
Go To Part 1 of PHP, JSON and JavaScript in Web2.0 Applications In conclusion:

JSON support in PHP

PHP 5 comes with built in support of JSON format. Function json_encode() 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 leading 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.

Go To Part 2 of PHP, JSON and JavaScript in Web2.0 Applications
Go To Part 1 of PHP, JSON and JavaScript in Web2.0 Applications
Subscribe to PHP-Editors FREE Newsletter to learn more about PHP tools and techniques
© Copyright 2003-2023 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.