Skip to content

Instantly share code, notes, and snippets.

@jonasporto
Forked from Pephers/heredoc-function.php
Created May 8, 2017 13:47
Show Gist options
  • Save jonasporto/54b09af1fae2f1e8e3873d7091cde662 to your computer and use it in GitHub Desktop.
Save jonasporto/54b09af1fae2f1e8e3873d7091cde662 to your computer and use it in GitHub Desktop.
How to call a PHP function inside a Heredoc.
<?php
$cb = function ($fn) {
return $fn;
};
echo <<<HEREDOC
Hello, {$cb(ucfirst('world'))}
HEREDOC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment