how to declare variable in php in post method or session variable code example
Example 1: php sessions
<?php
session_start();
$_SESSION['item_name'] = 'value';
$_SESSION['item_name'] = 0;
$_SESSION['item_name'] = 0.0;
$value = $_SESSION['item_name'];
?>
Example 2: set php varibianle session
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
$_SESSION["color"]= "blue";
$_SESSION["animal"]= "dog";
echo "The session variable are set up.";
?>
</body>
</html>
Example 3: php session variables
<?php
session_start();
$_SESSION['var'];
?>
Example 4: echo session
print_r($_SESSION);