Re: Re: Set Variable = Long HTML String?
| From: | John Wells | Date: | Sat, 07 Oct 2006 16:21:58 +0000 |
| Subject: | Re: Re: Set Variable = Long HTML String? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242801@lists.php.net to get a copy of this message | ||
On 10/7/06, Noah Cutler <sit1way@hotmail.com> 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@gmail.com> To: "sit1way" <sit1way@hotmail.com> Cc: <php-general@lists.php.net> Sent: Saturday, October 07, 2006 12:03 PM Subject: Re: [PHP] Re: Set Variable = Long HTML String? On 10/7/06, sit1way <sit1way@hotmail.com> wrote: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);">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!<option selected="selected">News Options</option> <option value="{$this->doc_path}admin/news/add/1/">Add</option> <optionvalue="{$this->doc_path}admin/news/update/1/">Update</option><optionvalue="{$this->doc_path}admin/news/delete/1/">Delete</option> </select> </form> HEREDOC; [/code] HTH, John WTIA, --Noah -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php