3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_invoices() { return [ [ "id" => 1, "customer_id" => 81136, ], [ "id" => 2, "customer_id" => 81136, ], [ "id" => 3, "customer_id" => 81100, ], ]; } function get_customer_invoices($customer_id = null) { if ($customer_id) { // return result of `array_filter` from `get_customer_invoices` function return array_filter(get_invoices(), function ($item) use ($customer_id) { // array_filter's callback should return `true` or `false` return $item['customer_id'] === $customer_id; }); } else { return false; } } var_dump(get_customer_invoices(81136));
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(2) { ["id"]=> int(1) ["customer_id"]=> int(81136) } [1]=> array(2) { ["id"]=> int(2) ["customer_id"]=> int(81136) } }

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:
124.98 ms | 405 KiB | 5 Q