What are the advantages and disadvantages of directly accessing system values in a template system without additional assignment?

When directly accessing system values in a template system without additional assignment, the advantage is that it can save time and code by accessing the values directly. However, the disadvantage is that it can make the code less readable and harder to maintain, as it may not be clear where the values are coming from. To solve this issue, it is recommended to assign the system values to variables before using them in the template.

// Assign system values to variables before using them in the template
$userName = $_SESSION['user_name'];
$userEmail = $_SESSION['user_email'];

// Use the assigned variables in the template
echo "Welcome, $userName! Your email is $userEmail.";