View Full Version : Resolved if statement with 2 things?
05-08-2009, 07:54 PM
I want to make an if statement where there's two criterias thingys lol
if ($user_class->admin = 1)
But I want it so if admin=2 it displays the same thing :D
05-08-2009, 07:59 PM
if ($user_class->admin == 1 || $user_class->admin == 2)
You can also use a switch on it:
// Do stuff;
Or check if its in an array of the 'allowed' I'd guess:
$aAllowed = array(1, 2);
if (in_array($user_class->admin, $aAllowed))
I'd go for either the switch or the array, depending on if it can be dynamic or if it is something you'd expect to change frequently (use array if its dynamic, switch if you'll be changing it regularily).
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.