<?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
How to check whether a given year is a leap year using php. |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |
Create a PHP script that calculates the average of an array of numbers. |
Create a PHP script that prints the current date and time. |
Create a simple PHP script that calculates the sum of all even numbers between 1 and 10. |
Write a PHP script that calculates the factorial of a given number. |
Write a PHP function that throws a custom exception if a condition is not met. |
Write a PHP script that connects to a MySQL database and fetches data from a table. |
