3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on nrhEc
Output for 7.1.0 - 7.3.0beta1
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 5.6.30, 7.0.30
Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Notice: Undefined variable: array in /in/qmP09 on line 33 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Notice: Undefined variable: array in /in/qmP09 on line 33 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Notice: Undefined variable: array in /in/qmP09 on line 33 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Notice: Undefined variable: array in /in/qmP09 on line 33 Warning: Missing argument 3 for test_print() in /in/qmP09 on line 31 Notice: Undefined variable: array in /in/qmP09 on line 33 array(10) { ["credit_card"]=> array(5) { ["cvc"]=> string(3) "123" ["expiry"]=> array(2) { ["month"]=> string(2) "12" ["year"]=> string(4) "2019" } ["name"]=> string(6) "Julian" ["number"]=> string(16) "5123450000000008" ["token"]=> NULL } ["amount"]=> string(2) "10" ["currency"]=> string(3) "AUD" ["gateway"]=> array(3) { ["line_of_business"]=> string(7) "eWallet" ["service"]=> string(7) "default" ["username"]=> NULL } ["external_id"]=> string(14) "my external id" ["reference"]=> string(11) "julian test" ["remitter_name"]=> NULL ["request_id"]=> string(10) "1529561070" ["statement_description"]=> NULL ["security_id"]=> NULL }
Output for hhvm-3.22.0
Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line -1 array(10) { ["credit_card"]=> array(5) { ["cvc"]=> string(3) "123" ["expiry"]=> array(2) { ["month"]=> string(2) "12" ["year"]=> string(4) "2019" } ["name"]=> string(6) "Julian" ["number"]=> string(16) "5123450000000008" ["token"]=> NULL } ["amount"]=> string(2) "10" ["currency"]=> string(3) "AUD" ["gateway"]=> array(3) { ["line_of_business"]=> string(7) "eWallet" ["service"]=> string(7) "default" ["username"]=> NULL } ["external_id"]=> string(14) "my external id" ["reference"]=> string(11) "julian test" ["remitter_name"]=> NULL ["request_id"]=> string(10) "1529561070" ["statement_description"]=> NULL ["security_id"]=> NULL }
Output for hhvm-3.18.5 - 3.21.3
Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 Warning: test_print() expects exactly 3 parameters, 2 given in /in/qmP09 on line 33 array(10) { ["credit_card"]=> array(5) { ["cvc"]=> string(3) "123" ["expiry"]=> array(2) { ["month"]=> string(2) "12" ["year"]=> string(4) "2019" } ["name"]=> string(6) "Julian" ["number"]=> string(16) "5123450000000008" ["token"]=> NULL } ["amount"]=> string(2) "10" ["currency"]=> string(3) "AUD" ["gateway"]=> array(3) { ["line_of_business"]=> string(7) "eWallet" ["service"]=> string(7) "default" ["username"]=> NULL } ["external_id"]=> string(14) "my external id" ["reference"]=> string(11) "julian test" ["remitter_name"]=> NULL ["request_id"]=> string(10) "1529561070" ["statement_description"]=> NULL ["security_id"]=> NULL }