How can you output a variable in PHP while excluding the last four characters?

To output a variable in PHP while excluding the last four characters, you can use the substr() function to extract a substring from the variable starting from the beginning up to the length of the variable minus four. This will effectively remove the last four characters from the output.

$variable = "HelloWorld";
$output = substr($variable, 0, -4);
echo $output;