Manage Session In PHP 8 Application Example

PHP 8 , PHP

Nicesnippets

835

04-08-2021


Manage Session In PHP 8 Application Example

Hi guys,

Today i will explained How To Manage Session In PHP Application Example. This example is so easy to use in php.

The session communication is two medium is known as session in PHP 8, and the session is put into to use for storing the data into a cloud server instead of the user’s personal computer. A session a process to store information, which can be used by multiple other pages.

So let's start to the example.

Create A New Session In PHP 8


<?php

session_start();

?>

Storing Session Data In PHP 8

<?php

session_start();

$_SESSION["name"] = "John";

$_SESSION["age"] = "30";

?>

Accessing Session Data In PHP 8

<?php

session_start();

echo 'The Name of the employee is :' . $_SESSION["name"] ;

echo 'The Age of the employee is :' . $_SESSION["age"];

?>

Destroying Single Session Data In PHP 8

<?php

session_start();

if(isset($_SESSION["name"])){

unset($_SESSION["age"]);

}

?>

Destroying Complete Session Data In PHP 8

<?php

session_start();

session_destroy();

?>

Now you can check your own.

I hope it can help you...


Recommended Posts