Re: here document

From: Date: Thu, 02 Nov 2000 06:28:00 +0000
Subject: Re: here document
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-23330@lists.php.net to get a copy of this message
Jason Brooke writes: > > Don't forget that you can just do <?=$var?> or even handy things like > <?=$someval?$onevar:$anothervar?> for conditional ouput > > here doc is great if you've got a bunch of html and simple $variables, > but you'll probably find there's lots of times where it's annoying to > use it. > > great to have a choice, huh? :) > > jason [how did this get into two threads? :)] Yes, but <?= is nonportable. If you have total control over the server, and know that you're never using PHP with XML, that's fine and you can enable it using short_open_tag. Otherwise, it's not available. For instance, I typically write code which could be executed on a client server over which I have no control. It *must* not rely on this sort of thing. That's why we always use the long <?php form in the manual; it's the only one (apart from <script language="php">) which is always guaranteed to work. Here docs also cannot be turned off. > > Thanks very much to all for the great info shared. > > Torben, that's a perfect example. It is DEFINITELY a PITA to output > form > > variables with all these <?PHP echo $something;?> all over the place. > > The fact that the here doc option also lets you use the variables > allows for > > some easily/quickly coded html that has the occasional variable in > it... > > all the best, > > Jack Dempsey -- +----------------------------------------------------------------+ |Torben Wilson <torben@php.net> Netmill iTech| |http://www.coastnet.com/~torben http://www.netmill.fi| |Ph: 1 250 383-9735 torben@netmill.fi| +----------------------------------------------------------------+

« previous php.general (#23330) next »