![]() |
syntax problems with checking for constants in an array?
if ($user[membergroupids] == USERGROUP_A) always returns true, but
if ($user[membergroupids] == 'USERGROUP_A') and if ($user[membergroupids] == " . USERGROUP_A . ") always returns false If I just go if ($user[membergroupids] == '2'), it works as it should. Similarly, later on, if ($groupid != USERGROUP_A) branches properly. WTF am I doing wrong? |
Have you tried $user['membergroupids'] ?
|
That doesn't seem to affect it.
Thanks, though. |
$user[membergroupids] is a list of user groups separated by commas
you need to explode(',') it and get an array with a list of user group ids to work with not sure if constants get parsed inside quotes, but this if ($user[membergroupids] == " . USERGROUP_A . ") should work I think O_o |
Correct. I was actually trying to check for one (and only one) membergroup. If there were more than one, it branched and did something else.
Quote:
|
Code:
if ($user[membergroupids] == " . USERGROUP_A . ") |
still he's curious, as am I
|
PHP Code:
|
Quote:
Code:
if ($user[membergroupids] == "" . USERGROUP_A . "") |
Why even add the empty strings around it though?
PHP Code:
|
All times are GMT. The time now is 11:48 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|