3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = [ 'admin' => [ 'user', 'changeUser', ], 'user' => [ 'guest', 'updatePassword', ], 'guest' => [ 'login', 'admin', ], ]; $role = 'admin'; $permissions = $a[$role]; $groups = []; $final = []; while (!empty($permissions)) { $permission = array_shift($permissions); if (in_array($permission, $groups)) { continue; } if (!empty($a[$permission])) { array_push($groups, $permission); array_push($permissions, ...$a[$permission]); } else { $final[] = $permission; } } var_export($final);
Output for git.master_jit, git.master
array ( 0 => 'changeUser', 1 => 'updatePassword', 2 => 'login', 3 => 'changeUser', )

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:
47.79 ms | 768 KiB | 4 Q