//ads:
?>
PHP using str_starts_with for array to exclude same as with wildcard
PHP Snippet 1:
$ignoreRoutes = [
'administrator',
'attachImage',
'login',
'logout',
'loginToPanel',
'attachImage',
'settingsList',
'settingsCreate',
'settingsStore',
'settingsEdit',
'settingsUpdate',
'settingsDestroy',
'usersPermission',
'posts'
];
$tests = ['usersPermission.index','usersPermission.create','xx.create'];
foreach($tests as $test){
$ignore = false;
foreach($ignoreRoutes as $ignoreRoute){
if(strpos($test,$ignoreRoute) === 0) {
$ignore = true;
break;
}
}
if($ignore) echo 'ignore '.$test."<br>\n";
else echo 'not ignore '.$test."<br>\n";
}
PHP Snippet 2:
ignore usersPermission.index
ignore usersPermission.create
not ignore xx.create