How can we register the variables into a Session?

Answer Posted / animesh dutta

<?php
// Start the session
session_start();
?>
<?php
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat";
echo "Session variables are set.";
?>

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is PECL?

773


What is helper library?

503


What is session in php w3schools?

546


Is it possible multiple inheritance in php?

572


What is get method in java?

521






What is sql injection in php?

522


Differentiate between php5 and php7?

623


How to open standard output as a file handle?

554


How to compare two strings with comparison operators in php?

521


What is difference between strstr() and stristr()?

520


What does the unset() function means?

587


Why namespace is used in php?

531


How are cookies created?

536


Can php run on windows server?

514


What is the use of hooks?

521