<?php $roleRequiredToLogin = 'dev-keboola-gcp-us-central1_APP_LoginKeboola'; $projectRole = 'dev-keboola-gcp-us-central1_APP_Keboola'; $orgRole = 'dev-keboola-gcp-us-central1_APP_OrgKeboola'; $strings = [ $roleRequiredToLogin, $projectRole.'_', $orgRole.'_', ]; if (array_unique($strings) !== $strings) { throw new \InvalidArgumentException('The strings must be unique'); } foreach ($strings as $potentialPrefix) { foreach ($strings as $stringToCompareTo) { if ($potentialPrefix === $stringToCompareTo) { continue; } if (strpos($stringToCompareTo, $potentialPrefix) === 0) { throw new \InvalidArgumentException(sprintf( '"%s" is a prefix of "%s"', $potentialPrefix, $stringToCompareTo )); } } } echo 'Success';
You have javascript disabled. You will not be able to edit any code.