Today we are going to learn that, how we can create a session object using PHP. To do this we must have knowledge of basics of PHP. See below diagram of code.
As you can see the code of creating the session variable in PHP.
There are some terminologies are there.
First of all, we have to create a file with any name but must be having the extension .php
After creating the file we have to open it in any of the text editors.
Now the main coding starts from here,
Firstly, we have to write the syntax of creating the PHP document like
Inside this tag, we will write our code.
So to perform any operations on the session object in PHP we must have written a function session_start() on the first line of the program. It will start the session.
After that, we have to declare the session variable like this
$_SESSION[name of the session variable] = value of that session variable;
Now our session object has been created, now we can run our program.
To run the program we have to write like this in the browser.
To execute the PHP program wamp server or any relevant server must be installed on our computer
After executing this It will return output like this.
Now we have understood that how we can create the session variable/object in PHP.
Still, have any double then please write your query in the comment box definitely I will try to resolve your query.
If you want a post on how to install wamp server on the computer, then please mention in the comment box.
Thanks for reading the post/article.
How do we destroy a session object in php..?