array2json() - Convert PHP arrays to JSON

array2json is a PHP function that will convert the array given as its argument into a JSON string. The created JSON string will be returned. This is very useful in Ajax apps using JSON over XML. If you are using XML, you better off using my xml2array() JavaScript function.

Note: This is an old function - if you use a new version of PHP(5.2 or newer) you will get the json_encode() function. That can be used to convert arrays to a JSON string.