What are some common methods for passing variables in PHP without using POST or GET?

When passing variables in PHP without using POST or GET, one common method is to use sessions. Sessions allow you to store variables that can be accessed across multiple pages within the same session. Another method is to use cookies, which can store variables on the client-side and be accessed on subsequent page loads. Additionally, you can use hidden form fields to pass variables between pages without displaying them to the user.

// Using sessions to pass variables
session_start();
$_SESSION['variable_name'] = 'value';

// Using cookies to pass variables
setcookie('variable_name', 'value', time() + 3600); // expires in 1 hour

// Using hidden form fields to pass variables
<form action="next_page.php" method="post">
    <input type="hidden" name="variable_name" value="value">
    <input type="submit" value="Submit">
</form>