What are some common methods for passing variables between PHP pages?

One common method for passing variables between PHP pages is to use sessions. By storing variables in the $_SESSION superglobal array, you can access them across multiple pages within the same session. Another method is to use cookies, which can store variables on the client side and make them available on subsequent page loads. Lastly, you can pass variables through URLs by appending them as query parameters.

// Using sessions to pass variables between PHP pages
session_start();
$_SESSION['username'] = 'JohnDoe';
```

```php
// Using cookies to pass variables between PHP pages
setcookie('username', 'JaneSmith', time() + 3600, '/');
```

```php
// Passing variables through URLs
$variable = 'example';
header("Location: nextpage.php?var=$variable");