$_SESSION — $_SESSION is a super global Session variable. An associative array containing session variables available in the current script. $_SESSION is available in all scopes throughout a script.
session_start() is required before using $_SESSION variable. Because session_start() creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a COOKIE.
So, if we don’t write session_start() then we can’t use the $_ SESSION global variable.
When session_start() is called or when a session auto starts, PHP will call the open and read session save handlers.
Example:- $_SESSION[“sessionname”]=$sessionvalue;
$_ENV — $_ENV is a super global associative array variable. $_ENV passed associative array variable via. environment method.
$_ENV variables are imported from the environment under which PHP interpreter is running and many are provided by the shell under which PHP is running.
$_ENV variables are imported into PHP’s global namespace from the environment under which the PHP parser is running. Many are provided by the shell under which PHP is running and different systems are likely running different kinds of shells, a definitive list is impossible.
getenv() PHP function is used to retrieve the list of single or all environment variables or the value of a specific environment variable.
putenv() function sets the value of an environment variable
Example:-
<?php
echo $_ENV[“username”];
?>
<?php
echo $ip = getenv(‘REMOTE_ADDR’);
?>
<?php
print “env is: “.$_ENV[“USER”].”\n”;
print “(Putting: putenv Rock)\n”;
putenv(“USER=Rock”);
print “env is: “.$_ENV[“USER”].”\n”;
print “getenv is: “.getenv(“USER”).”
?>