Tools, FAQ, Tutorials:
json_decode() Function in PHP
Where to get the detailed description of the json_decode() Function in PHP?
✍: FYIcenter.com
Here is the detailed description of the
json_decode() Function in PHP.
Description - The json_decode() function parses a JSON text string and converts it into a PHP variable.
Syntax -
mixed json_decode(string $json[, bool $assoc=false[, int $depth=512[, int $options=0]]])
Parameters -
Return value - PHP value in appropriate data type representing the JSON text string. NULL is returned if the $json cannot be decoded or if the encoded data is deeper than the recursion limit.
Examples -
<?php
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));
# Output:
#
# object(stdClass)#1 (5) {
# ["a"] => int(1)
# ["b"] => int(2)
# ["c"] => int(3)
# ["d"] => int(4)
# ["e"] => int(5)
# }
#
# array(5) {
# ["a"] => int(1)
# ["b"] => int(2)
# ["c"] => int(3)
# ["d"] => int(4)
# ["e"] => int(5)
# }
?>
2023-02-28, ∼2483🔥, 0💬
Popular Posts:
What is the "__init__()" class method? The "__init__()" class method is a special method that will b...
Tools, FAQ, Tutorials: JSON Validator JSON-XML Converter XML-JSON Converter JSON FAQ/Tutorials Pytho...
How to use the "Ctrl-p Ctrl-q" sequence to detach console from the TTY terminal of container's runni...
What is EPUB 3.0 Metadata "dc:description" Element? EPUB 3.0 Metadata "dc:description" is an optiona...
How To Move Uploaded Files To Permanent Directory in PHP? PHP stores uploaded files in a temporary d...