On 10/7/06, Noah Cutler <sit1way@xxxxxxxxxxx> wrote:
Yah, John. Just found it via Google. I remembered seeing this somewhere a couple years back but never used it. Very cool -- performance hit using this, or just a really useful function?
From what I understand it suffers the same "hit" as double quotes,
since PHP has to parse it looking for variables. But it's not really "special", it's just not as well known. - John W
Thanks, --Noah ----- Original Message ----- From: "John Wells" <wellsdjohn@xxxxxxxxx> To: "sit1way" <sit1way@xxxxxxxxxxx> Cc: <php-general@xxxxxxxxxxxxx> Sent: Saturday, October 07, 2006 12:03 PM Subject: Re: Re: Set Variable = Long HTML String? > On 10/7/06, sit1way <sit1way@xxxxxxxxxxx> wrote: >> I'm overhauling my PHP based CMS and want to know how to set a variable >> equal to an HTML string, but without having to escape all the quotes! > > Noah, meet HEREDOC. HEREDOC, meet Noah: > > http://uk.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc > > Now you cozy two, let's make it a party with the Complex (Curly {}) > syntax: > > http://uk.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex > > All together now! > > [code] > $var =<<<HEREDOC > <form name="events" method="POST" action=""> > <select class="menus" name="news" > onChange="MM_jumpMenu('parent',this,0);"> > <option selected="selected">News Options</option> > <option value="{$this->doc_path}admin/news/add/1/">Add</option> > <option > value="{$this->doc_path}admin/news/update/1/">Update</option> > <option > value="{$this->doc_path}admin/news/delete/1/">Delete</option> > </select> > </form> > HEREDOC; > [/code] > > HTH, > John W > >> TIA, >> >> --Noah >> >> >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php