2

I added following few lines on top of my PHP code, but it is giving error the error is

Function name must be a string in /home/developeriq/public_html/doylesweb/hotel_search.php on line 3

 if(!isset($_session)) {
 $session_start();}
0

1 Answer 1

2

Your code is wrong:

 if(!isset($_session)) {
 $session_start();}

$session_start() should be session_start(). $ is for variables, session_start() is a function, not a variable, thus, $ is not required.

Also, it must be capitalised as it's a superglobal array. (Credits to @AkshayPrakash for pointing out)

 if(!isset($_SESSION)) {
 session_start();}

Documentation: http://php.net/manual/en/reserved.variables.session.php

Sign up to request clarification or add additional context in comments.

6 Comments

thanks now not giving any error.
@shubhamsingh Maybe accept this answer by clicking on the tick mark below the upvote/ downvote buttons, thanks
Also $_session should be $_SESSION
@AkshayPrakash Thanks for pointing out, updated post
Might want to tell the OP why that change should be made, instead of a copy paste fix
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.