PHP - Sessions and Cookies
What will be the output of this PHP code?
<?php session_start(); $_SESSION['role'] = 'admin'; echo $_SESSION['role']; ?>
<?php session_start(); $_SESSION['role'] = 'admin'; echo $_SESSION['role']; ?>
session_start() initializes the session or resumes the current one.$_SESSION['role'] = 'admin'; sets the session variable 'role' to 'admin'.echo $_SESSION['role']; prints the value stored in the session variable, which is 'admin'.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions