<?php
session_start();
// makes an array
$colors=array('red', 'yellow', 'blue');
// adds it to our session
$_SESSION['color']=$colors;
$_SESSION['size']='small';
$_SESSION['shape']='round';
$_SESSION['diameter']='10cm';
$_SESSION['LoggedIn']='user';
print "Done";
function fnCheckSession(){
if ($_Session['LoggedIn'] !=null)
echo "Session variable exist.";
else
echo "Session variable does not exist.";
}
fnCheckSession();
?>
The following errors appears:
Done
Notice: Undefined variable: _Session in C:\xampp\htdocs\php_exercise\exercise2_2.php on line 20
Session variable does not exist.
Line 20 is: if ($_Session !=null)
Why Session variable does not exist? I thought I already declares session variables above:
$_SESSION='user';