Created
August 19, 2020 07:09
-
-
Save lftbrts/62df1684561a67ddfc8d1284f45d2d4c to your computer and use it in GitHub Desktop.
simple hierarchy calculation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$hierarchy = [ | |
'CUSTOMER_ADMIN', | |
'ADMIN', | |
'BUYER', | |
]; | |
$currentRoles = [ | |
'BUYER', | |
'ADMIN', | |
'IGNORE', | |
]; | |
$highestRole = array_intersect($hierarchy, $currentRoles); | |
var_dump(reset($highestRole)); // output ADMIN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment