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

How do you remove whitespace from the beginning and end of a $string variable?

509


Which function is used to strip whitespace?

444


What is difference between include,require,include_once and require_once()?

532


How to repeat a string to a specific number of times in php?

530


Is php a programming language?

554






Is not null mysql?

547


What type of errors can be occurred in php?

561


What is the role of php.ini file?

550


What is the phpstorm?

532


How to remove all duplicate values in array in php?

523


Why overriding is called runtime polymorphism?

533


What is the difference between pop3 IMAP and MAPI?

643


What is the special meaning of __sleep and __wakeup?

573


What are the encryption functions in php?

569


What is T_PAAMAYIM_NEKUDOTAYIM?

679