In what scenarios should PHP functions be called in .tpl files to transform data before output?

When you need to transform or manipulate data before outputting it in a .tpl file, you can call PHP functions within the .tpl file itself. This can be useful for tasks such as formatting dates, converting data types, or any other data manipulation needed before displaying it to the user. Example:

<?php
// Sample data to be transformed
$data = "Hello World";

// Calling a PHP function to transform the data
$transformed_data = strtoupper($data);

// Output the transformed data
echo $transformed_data;
?>