$json
[, bool $assoc
= false
[, int $depth
= 512
[, int $options
= 0
]]] )
Takes a JSON encoded string and converts it into a PHP variable.
Anonymous user / 18.116.20.205 Log In Register |
?
Wallet:
3.00
Daily Credits:
1.20 / 1.20
|
This is your credit balance. Even if you are an anonymous user, you are given some credits to spend. Every IP address has its own account and it is provided with free credits that can be used to pay for Online Domain Tools services. Moreover, credit balance is reset every day. This is why we call them Daily Credits. Registered users have higher Daily Credits amounts and can even increase them by purchasing subscriptions.
Besides Daily Credits, all accounts, including IP address accounts of anonymous users, have their credit Wallet. Wallet credits are not reset on a daily basis, but they are only spent when a user has not enough Daily Credits. Registered users can buy credits to their wallets. All IP address accounts are created with an initial Wallet balance of 3.00. Once IP address account spends credits from its Wallet, it can not be charged again. This should allow new users to try most of Online Domain Tools services without registration.
$json
[, bool $assoc
= false
[, int $depth
= 512
[, int $options
= 0
]]] )
Takes a JSON encoded string and converts it into a PHP variable.
The json
string being decoded.
This function only works with UTF-8 encoded strings.
Note:
PHP implements a superset of JSON - it will also encode and decode scalar types and
NULL
. The JSON standard only supports these values when they are nested inside an array or an object.
When TRUE
, returned objects will be converted into
associative arrays.
User specified recursion depth.
Bitmask of JSON decode options. Currently only
JSON_BIGINT_AS_STRING
is supported (default is to cast large integers as floats)
Returns the value encoded in json
in appropriate
PHP type. Values true, false and
null (case-insensitive) are returned as TRUE
,
FALSE
and NULL
respectively. NULL
is returned if the
json
cannot be decoded or if the encoded
data is deeper than the recursion limit.
Example #1 json_decode() examples
<?php
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));
?>
The above example will 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) }
Version | Description |
---|---|
5.4.0 |
The options parameter was added.
|
5.3.0 | Added the optional depth . The default recursion depth was
increased from 128 to 512
|
5.2.3 | The nesting limit was increased from 20 to 128 |
5.2.1 | Added support for JSON decoding of basic types. |
Note:
The JSON spec is not JavaScript, but a subset of JavaScript.
Note:
In the event of a failure to decode, json_last_error() can be used to determine the exact nature of the error.