3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "credit_card": { "cvc": "123", "expiry": { "month": "12", "year": "2019" }, "name": "Julian", "number": "5123450000000008", "token": null }, "amount": "10", "currency": "AUD", "gateway": { "line_of_business": "eWallet", "service": "default", "username": null }, "external_id": "my external id", "reference": "julian test", "remitter_name": null, "request_id": "1529561070", "statement_description": null, "security_id": null }'; $array = json_decode($json, true); function test_print($item, $key, &$array) { if ($item === null) unset($array[$key]); } array_walk_recursive($array, 'test_print'); var_dump($array);
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught ArgumentCountError: Too few arguments to function test_print(), 2 passed and exactly 3 expected in /in/qmP09:31 Stack trace: #0 [internal function]: test_print('123', 'cvc') #1 /in/qmP09(36): array_walk_recursive(Array, 'test_print') #2 {main} thrown in /in/qmP09 on line 31
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught ArgumentCountError: Too few arguments to function test_print(), 2 passed and exactly 3 expected in /in/qmP09:31 Stack trace: #0 [internal function]: test_print('123', 'cvc') #1 /in/qmP09(36): array_walk_recursive(Array, 'test_print') #2 {main} thrown in /in/qmP09 on line 31
Process exited with code 255.

preferences:
157.75 ms | 402 KiB | 163 Q