3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [["b" => "loc04", "c" => ["administrator" => "administrator"]]]; $arr[] = ["b" => "loc23", "c" => ["administrator" => "administrator", "publisher" => "publisher"]]; $arr[] = ["b" => "loc12", "c" => ["publisher" => "publisher", "viewer" => "viewer"]]; $role = "administrator"; //$a = array_filter($arr, function ($e) use ($role) {return in_array($role, $e["c"]);}); $a = array_filter($arr, function ($e) use ($role) {return isset($e["c"][$role]);}); print_r($a);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [b] => loc04 [c] => Array ( [administrator] => administrator ) ) [1] => Array ( [b] => loc23 [c] => Array ( [administrator] => administrator [publisher] => publisher ) ) )

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:
28.44 ms | 406 KiB | 5 Q