Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<json_decodekadm5>
Last updated: Tue, 19 Sep 2006

json_encode

(no version information, might be only in CVS)

json_encode -- Returns the JSON representation of a value

Description

string json_encode ( mixed value )

Returns a string containing the JSON representation of value.

Parameters

value

The value being encoded. Can be any type except a resource.

Return Values

Returns a JSON encoded string on success.

Examples

Example 1. A json_encode() example

<?php
$arr = array ('a'=>1,'b'=>2,'c'=>3,'d'=>4,'e'=>5);

echo json_encode($arr);
?>

The above example will output:

{"a":1,"b":2,"c":3,"d":4,"e":5}

See Also

json_decode()




<json_decodekadm5>
Last updated: Tue, 19 Sep 2006