filburt1
08-16-2002, 09:27 AM
I have a bunch of predefined constants starting with GPERM_ in addition to some other defined constants. How can I take the values of every constant that starts with GPERM_ and make it into a string that looks like value1,value2...valuen?
filburt1
08-16-2002, 10:18 AM
NM, figured it out (I imploded the array later on):
echo 'Creating list of user permissions...';
$constants = get_defined_constants();
$perms = array();
$current = each($constants);
define('PERM_PREFIX', 'GPERM_');
while ($current != false)
{
if (substr($current['key'], 0, strlen(PERM_PREFIX)) == PERM_PREFIX)
{
array_push($perms, $current['value']);
}
$current = each($constants);
}
echo 'Done<br>';