Which is the correct way to check if a session has already been started ?



Which is the correct way to check if a session has already been started ?..

Answer / Siddharth Chaudhary

"You can check if a session has already been started in PHP by using session_id() function. If session_id() returns a value, it means the session has already been started. Otherwise, you need to start it with session_start()."

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

Explain how we can get the number of elements in an array?

1 Answers  


How to use the COM components in PHP?

2 Answers   HCL,


Write a php script to get the largest key in an array?

1 Answers  


What is super keyword in c++?

1 Answers  


How can we upload a file in php?

1 Answers  


How to remove a file?

1 Answers  


Which function would you use to read a line of data from a file in php?

1 Answers  


What is session management php?

1 Answers  


How to get seconds from current date using date function ?

8 Answers   Sarna Technologies, Satyam,


How many different types of messages available in php?

1 Answers  


What are the differences between PHP 3 and PHP 4 and PHP 5?

2 Answers  


What is the difference between ereg_replace() and eregi_replace()?

2 Answers   Quicknet,


Categories