Jolten
08-07-2005, 06:11 PM
Hi,
I've got this code in a php file
(!in_array($bbuserinfo['usergroupid'], array(6,2,11,12,7,5,14,15,18)))
It works great. What I'm wondering is if I can assign a variable to the array similar to:
$good = "6,2,11,12,7,5,14,15,18";
if ((!in_array($bbuserinfo['usergroupid'], array($good))) {
blah
} else {
blah blah
}
will work just as good? I can't seem to get the variable to carry into the array.
This is mainly to allow me to alter usergroup settings once per page rather than having to hunt down several lines of code with the array in it.
Okay I answered my own question.
$good = array(6,2,11,12,7,5,14,15,18);
if ((!in_array($bbuserinfo['usergroupid'], $good))) {
blah
} else {
blah, blah
}
works.
I've got this code in a php file
(!in_array($bbuserinfo['usergroupid'], array(6,2,11,12,7,5,14,15,18)))
It works great. What I'm wondering is if I can assign a variable to the array similar to:
$good = "6,2,11,12,7,5,14,15,18";
if ((!in_array($bbuserinfo['usergroupid'], array($good))) {
blah
} else {
blah blah
}
will work just as good? I can't seem to get the variable to carry into the array.
This is mainly to allow me to alter usergroup settings once per page rather than having to hunt down several lines of code with the array in it.
Okay I answered my own question.
$good = array(6,2,11,12,7,5,14,15,18);
if ((!in_array($bbuserinfo['usergroupid'], $good))) {
blah
} else {
blah, blah
}
works.