PHP session_start() Function

What is session_start Function?

Explanation

The "session_start()" function is used to initialize session data.

Syntax:


session_start()

In the above syntax the function does not have parameters, but the function informs server that sessions are going to be used.

Example :


<?php
session_start();
$session = session_id();
echo "Session: $session<br/>";
?>
Result :

Session: 6aa701f50afab253d6c0f813ad8134bb

In the above example first the session is started then the session id is displayed, user can go ahead with any other data operations.

PHP Topics


Ask Questions

Ask Question