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); echo $count; //var_dump($response, $orderlist);
Output for 8.3.0 - 8.3.7
Warning: Trying to access array offset on null in /in/n7YdF on line 4 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/n7YdF on line 4 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/n7YdF:5 Stack trace: #0 {main} thrown in /in/n7YdF on line 5
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19
Warning: Trying to access array offset on value of type null in /in/n7YdF on line 4 Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /in/n7YdF on line 4 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/n7YdF:5 Stack trace: #0 {main} thrown in /in/n7YdF on line 5
Process exited with code 255.
Output for 8.0.10 - 8.0.30
Warning: Trying to access array offset on value of type null in /in/n7YdF on line 4 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /in/n7YdF:5 Stack trace: #0 {main} thrown in /in/n7YdF on line 5
Process exited with code 255.
Output for 8.0.0 - 8.0.9
Warning: Trying to access array offset on value of type null in /in/n7YdF on line 4 Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in /in/n7YdF:5 Stack trace: #0 {main} thrown in /in/n7YdF 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/n7YdF on line 4 Warning: count(): Parameter must be an array or an object that implements Countable in /in/n7YdF 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/n7YdF on line 5 0
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25
0

preferences:
172.79 ms | 402 KiB | 242 Q