<?php
session_start();
// Set session variables
$_SESSION['username'] = 'john_doe';
$_SESSION['user_id'] = 123;
// Display session data
echo "Username: {$_SESSION['username']}, User ID: {$_SESSION['user_id']}";
?>
<?php
session_start();
// Set session variables
$_SESSION['username'] = 'john_doe';
$_SESSION['user_id'] = 123;
// Display session data
echo "Username: {$_SESSION['username']}, User ID: {$_SESSION['user_id']}";
?>
Related
Create a PHP script that calculates and displays the area of a rectangle given its length and width. |
How to convert a temperature from Celsius to Fahrenheit using php. |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |
Write a PHP script that sets a cookie with user preferences and retrieves it on subsequent visits. |
How to get the largest element in an array of numbers |
Write a PHP script that calculates the sum of digits in a given number. |
Write a PHP function that throws a custom exception if a condition is not met. |
How to check if a given number is a perfect number. |
