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 array_filter_recursive($array) { $array = array_filter($array); foreach ($array as $key => $value) { if (!is_array($value)) { continue; } array_filter_recursive($value); } return $array; } var_dump(array_filter_recursive($array));
Output for git.master, git.master_jit, rfc.property-hooks
array(7) { ["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" ["request_id"]=> string(10) "1529561070" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
53.56 ms | 402 KiB | 8 Q