On Saturday 11 July 2009 15:23:55 tedd wrote: > At 8:34 PM -0400 7/10/09, Daniel Brown wrote: > >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: > > Why the braces? > > Cheers, > > tedd > > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com The braces ensure that PHP doesn't stop parsing the variable name once it reaches the [. By default, it will only match a variable name up to the [ sign, so you couldn't access arrays without the braces. -- Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php