PHP

[PHP] heredoc 내부에서 함수 호출하기 (calling function inside heredoc)

bloodguy 2020. 7. 14. 14:57

 

 

 

 

<?PHP
function toStrong($msg)
{
    return '<strong>'.$msg.'</strong>';
}
 
 
$toStrong = 'toStrong';
 
 
$s = <<<EOS
<div>
    <p>내 이름은 {$toStrong('백충덕')} 입니다.</p>
</div>
EOS;
 
 
echo $s;