Sunday 30 September 2012

json_encode - Returns the JSON representation of a value

string json_encode ( mixed $value [, int $options = 0 ] )
Returns the JSON representation of a value
Returns a string containing the JSON representation of value.

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

echo 
json_encode($arr);?>

5.4.0 JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, and JSON_UNESCAPED_UNICODE options were added. 5.3.3 JSON_NUMERIC_CHECK option was added. 5.3.0 The options parameter was added.

JSON - PHP y Javascript