user1226076
user1226076

Reputation: 35

Why can't I use $session_start()?

I got this error.

Notice: Undefined variable: session_start in C:\wamp\www\check.php on line 3

It says undefined variable on line 3, but here's line 3.

$session_start();

Why is this happening? Isn't session_start predefined?

Upvotes: 0

Views: 1535

Answers (4)

zzzzBov
zzzzBov

Reputation: 179046

session_start() is a function.

$session_start would be a variable if you defined it. The error message you're reading is simply telling you that the variable that you're trying to call as a function doesn't exist as such.

Upvotes: 6

j08691
j08691

Reputation: 207901

It's just session_start() with no $. See the manual.

Upvotes: 1

Aleks G
Aleks G

Reputation: 57316

session_start() is not a variable, but a function. You do not need the dollar sign. Change it to

session_start()

and it should work.

Upvotes: 2

James
James

Reputation: 3805

session_start()

It's not a variable.

Upvotes: 2

Related Questions