This example shows how PHP's htmlspecialchars function changes special characters in a string to HTML entities. We start with a raw string containing HTML tags and an ampersand. Then, htmlspecialchars converts < to <, > to >, and & to &. This prevents the browser from treating the string as HTML code. Finally, the safe string is printed. This protects the page from unwanted HTML or script injection. The execution table traces each step: assigning the raw string, applying htmlspecialchars, and printing the safe output. The variable tracker shows how $input stays the same while $safe changes to the escaped version. Key moments explain why escaping is needed and what happens without it. The quiz tests understanding of variable values and output at each step. Remember, always escape output with htmlspecialchars before showing user input in HTML.