esc($string, $context = 'html', $strict = false)
Escapes strings based on the output context
-
$string (string)
-
$context (string)
Location of output of the string -
$context (string)
Whether to escape an extended set of characters (HTML attributes only) -
return (string)
Example
echo esc($page->title(), 'html');
echo esc($page->link(), 'url');
Please check the Escape class documentation and its source code for more details and the available methods.