Jump to content

[SOLVED] can we give session a name like function in php


anujphp

Recommended Posts

Hello

the below code i got in forum to check where a user is logged in or not

<?php
if (isset($_SESSION['session_name_here'])) {
//  Code to be run here

}
?>

 

can anyone tell me what is this session_name_here means...

in my login page i am not giving any name to the session i am starting the session and saving name and other data in variable..

does this means the name i save in variable or it is that i can give a name to session like we give to a function

THANK YOU IN ADVANCE

 

 

 

While your into sessions look at this example bit off a mind blower i say.

 

this is a session created with a array but now you got 3 session's set.

<?php session_start();

$x=array("john"=>"Has a big bike","paul"=>"has got a color tv","kevin"=>"has a motor bike");

foreach($x as $key=>$val){

$_SESSION['username'][$key]=$val;


echo " $key ".$_SESSION['username'][$key]."<br><br> ";

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.