3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '{"ORDERLIST":"{\"ORDER_LIST\":[{\"order_id\":\"1756\",\"uname\":\"jordan\",\"prod_name\":\"ABC\",\"quantity\":\"1\",\"branch\":\"Dapitan\",\"totalPrice\":\"23500\"}"]}"}'; $response = json_decode($content, true); $orderlist = json_decode($response['ORDERLIST'], true); $count = count($response,COUNT_RECURSIVE); echo $count; //var_dump($response, $orderlist);
Output for 8.3.0 - 8.3.4
Warning: Trying to access array offset on null in /in/mlgro on line 4 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/mlgro on line 4 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/mlgro:5 Stack trace: #0 /in/mlgro(5): count(NULL, 1) #1 {main} thrown in /in/mlgro on line 5
Process exited with code 255.
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
Warning: Trying to access array offset on value of type null in /in/mlgro on line 4 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/mlgro on line 4 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/mlgro:5 Stack trace: #0 /in/mlgro(5): count(NULL, 1) #1 {main} thrown in /in/mlgro on line 5
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Warning: Trying to access array offset on value of type null in /in/mlgro on line 4 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/mlgro:5 Stack trace: #0 /in/mlgro(5): count(NULL, 1) #1 {main} thrown in /in/mlgro on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Notice: Trying to access array offset on value of type null in /in/mlgro on line 4 Warning: count(): Parameter must be an array or an object that implements Countable in /in/mlgro on line 5 0
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: count(): Parameter must be an array or an object that implements Countable in /in/mlgro on line 5 0
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
0

preferences:
197.75 ms | 402 KiB | 222 Q