<html>
<body>
function exclaim($str) {
return $str . "! ";
}
function ask($str) {
return $str . "? ";
}
function printFormatted($str, $format) {
// Calling the $format callback function
echo $format($str);
}
// Pass "exclaim" and "ask" as callback functions to printFormatted()
printFormatted("Hello world", "exclaim");
printFormatted("Hello world", "ask");
</body>
</html>