Code Syntax Error For Semicolon

Again, having an issue with my syntax code on my sessions page. I think fresh eyes really do help.

Here is my code:
[php]
class Session {
public static function exists($name) {
return (isset($_SESSION[$name])) ? true : false;
}

public static function put($name, $value) {
	return $_SESSION[$name] = $value;
}

public static function get($name) {
	return $_SESSION[$name];
}

public static function delete($name) {
	if(self::exists($name)) {
		unset($_SESSION[$name]);
	}
}

public static function flash($name, $string = '') {
	if(self::exists($name)) {
		$session = self::get($name);
		return $session;
	} else {
		self::put($name, $string);
	}
}

}
[/php]

I get this error:
Notice: Undefined variable: name in /home/students/phannum/public_html/n413/ooplr/classes/Session.php on line 4 Parse error: syntax error, unexpected ‘.’, expecting ‘,’ or ‘;’ in /home/students/phannum/public_html/n413/ooplr/classes/User.php on line 4.

Thanks!

A session variable is its own variable, not an I.Dec like you are using.

So $_Session[$name] != $_Session[‘name’]

Aslo, is set returns a Boolean. So your ternary operator is redundant.

Sponsor our Newsletter | Privacy Policy | Terms of Service