<?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
Write a PHP script that parses JSON data and displays specific information. |
Create a simple PHP script that calculates the sum of all even numbers between 1 and 10. |
Write a PHP script that checks if a given string is a valid email address. |
Write a PHP function that throws a custom exception if a condition is not met. |
Create a PHP script that counts the number of occurrences of each word in a given sentence. |
Create a PHP script that uses sessions to store and display user information. |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |
Create a PHP script that checks whether a given number is a prime number or not. |