I've read all the other articles on in_array, and still don't understand why mine is givng odd results. I'm inheriting this code from someone else, and don't fully understand why they did certain things. When a user logs in, data is grabbed from a db, one of the fields being their "level". 1 is an admin, 2 a regular user, etc. Once the data is grabbed from the db, we put the user level (stored as a:1:{i:0;s:1:"2") into an array:
$user_level = unserialize($this->result['user_level']);
$_SESSION['unt']['user_level'] = $user_level;
Later we check to see if this is an admin:
error_log(print_r($_SESSION['abc']['user_level'])); //this is always "1"
if (in_array('1', $_SESSION['abc']['user_level'])) { //should be yes, correct?
Yet somehow the if statement never evaluates as true, even though the SESSION variable is 1. What am I missing?