What are the advantages and disadvantages of using cookies instead of sessions for storing user data in a PHP application, particularly in a gaming scenario?

When storing user data in a PHP application, using cookies instead of sessions can have advantages such as being able to persist data across sessions and reducing server load. However, cookies can be manipulated by users, potentially compromising the security of the data being stored. In a gaming scenario, using cookies for sensitive user data may not be ideal due to the risk of tampering.

// Storing user data in a session
session_start();
$_SESSION['user_id'] = 123;
$_SESSION['username'] = 'example_user';

// Accessing user data from the session
$user_id = $_SESSION['user_id'];
$username = $_SESSION['username'];