So I'm trying to store an array in a session, but instead of making it an array it just counts everything up all the time! I just want the value that is done in the session, so I can check if the number isn't done already! There meight be a smarter way to it, but this will do for now!
public function nextNumber($list) {
$i = rand(1, count($list)-1);
echo $list[$i];
if (!in_array($list[$i], Session::get('savedlist'))) {
Session::put('savedlist', Session::get('savedlist') + $list[$i]);
var_dump(Session::get('savedlist'));
return $list[$i];
}
}
And this is my put function
public static function put($name, $value) {
return $_SESSION[$name] = $value;
}
public static function get($name) {
return $_SESSION[$name];
}