Skip to content
Snippets Groups Projects
Commit c4608794 authored by Raghav's avatar Raghav
Browse files

Session intro

parent 196a9131
No related branches found
No related tags found
No related merge requests found
sg.php 0 → 100644
<pre>
<?php
// To use session include this function
session_start();
print("_SESSION\n");
print_r($_SESSION);
// To Clear the values in session array but not delete.
if (isset($_GET['clear'])) {
printf("Clearing....\n");
session_unset();
}
/*
* We can assignment $_SESSION['A'];
* In string we can use without single quotes.
* print("a = $_SESSION[A]");
*/
if (isset($_SESSION['a'])) {
printf("Exsiting value a = $_SESSION[a]\n");
} else {
$_SESSION['a'] = time();
printf("Assigning value to a = $_SESSION[a]\n");
}?>
</pre>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment