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.
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example