PHP Session - What Is a Session in PHP?

What is a Session in PHP?

A PHP session is no different from a normal session. It can be used to store information on the server for future use. However this storage is temporary and is flushed out when the site is closed. Sessions can start by first creating a session id (unique) for each user.
Syntax :
session_start()

Example:
Storing a customer’s information.

What is a Session in PHP?

Sessions allow data to be transferred from one page to another. Session information is temporary and information is valid until the user is using the website. A session assigns a unique ID, UID, to each visitor.

A PHP session starts using:
<?php session_start(); ?>

PHP Session Variables:

A PHP session variable is used to hold values of the current session. A session needs to be started first.
<?php
session_start();
// store session data
$_SESSION['sample']=1;
?>

They can be used to hold information about a single user that is applicable to all web pages.

What Is a Session in PHP?

A PHP Session persist the user information to be used later. For example, user name, password, shopping item details. The session is temporary and will be removed soon after the user has left the web site. The session can be persisted for long term usage on databases like MySQL. Each session is identified by a unique Id number for every visitor. The first step to use PHP session is to start the session. The starting session must precede the operations like HTML or the other.

The statement session_start() starts the PHP session and registers the user’s information on the server.
PHP message - Explain the difference between $message and $$message?
PHP message - $message is used to store variable data. $$message can be used to store variable of a variable......
PHP Include & Require - What is the difference between include and require?
PHP Include & Require - Require () and include () are the same with respect to handling failures....
PHP Urlencode & Urldecode - What is urlencode and urldecode?
PHP Urlencode & Urldecode - Urlencode can be used to encode a string that can be used in a url..
Post your comment
Discussion Board
PHP Session
Yaha PHP Sessions are normally no longer to different to other sessions in our life as session is a track to store information about user (us) at server this is also (must) used to transer information from one page of website to another page of same website .

session must be declared at first line in PHP code as
$_SESSION_START();
Manish Prajapati 12-2-2013