Re: I am RTFM, but still stumbling on how to get built-in functions parsed in heredoc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 10, 2009 at 20:25, Govinda<govinda.webdnatalk@xxxxxxxxx> wrote:
> How do I  get
> basename(__FILE__)
> or
> htmlentities($somevar)
> to be evaluated  in a heredoc?

    You don't.  Instead, you have to store the output from those in a
variable (or array), then place it into the HEREDOC it.

<?php
$somevar = htmlentities($somevar);
$filedata = array('name' => basename(__FILE__), 'size' => filesize(__FILE__));

$html =<<<HTML
<b>File Name:</b> {$filedata['name']}<br />
<b>File Size:</b> {$filedata['size']}<br />

<b>\$somevar</b>: {$somevar}<br />

HTML;

echo $html;
?>



-- 
</Daniel P. Brown>
daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx
http://www.parasane.net/ || http://www.pilotpig.net/
Check out our great hosting and dedicated server deals at
http://twitter.com/pilotpig

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux