Re: constants in heredoc



Jeff escribió:
How do I use a constant in a heredoc?


$sample = <<<sample_code


SOME_CONSTANT


sample_code;

echo $sample;



The constant in that case is just showing it's "name".

As far as I know you cannot. Heredoc is not as useful as it looks :)

Anyway, there's a user note that suggests a dirty trick:

http://es2.php.net/manual/en/language.types.string.php#74744



--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
.



Relevant Pages

  • Re: constants in heredoc
    ... echo $sample; ... The constant in that case is just showing it's "name". ... there's a user note that suggests a dirty trick: ...
    (comp.lang.php)
  • Re: at HH:MM /interactive cmd /k
    ... The CMD window is NOT showing up for me ... echo %date% %time% Start of task> c:\test.log ... Now have a look at the two log files and all will become clear! ...
    (microsoft.public.win2000.general)
  • Re: Expect: How to define a standard procedure for logins
    ... Patrick Dunnigan wrote: ... use log_user 0 to hide the password from showing in your log ... Since the router will not echo the password back, ...
    (comp.lang.tcl)
  • Re: Pack & Go for Sound: HELP!!!
    ... yes as a separate file...theres also a file called "playlist" that keeps ... "Echo S" wrote: ... > presenter, PPT Live '04 ...
    (microsoft.public.powerpoint)
  • Re: Reading from file
    ... $content = fread ); ... echo; ... But in file news.txt I have formating that is not showing, ...
    (alt.php)