What are the potential risks or drawbacks of relying on cookies for storing session data in PHP?

Relying on cookies for storing session data in PHP can pose security risks as cookies can be easily manipulated by users. To mitigate this risk, it is recommended to use PHP's built-in session handling functions to store session data securely on the server side.

<?php
// Start a session
session_start();

// Store session data
$_SESSION['user_id'] = 123;
$_SESSION['username'] = 'john_doe';

// Access session data
echo $_SESSION['user_id'];
echo $_SESSION['username'];
?>