RE: [PHP] is <?= good?

From: Date: Fri, 11 Jun 2010 21:19:36 +0000
Subject: RE: [PHP] is <?= good?
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-306059@lists.php.net to get a copy of this message
> -----Original Message----- > From: David Harkness [mailto:david.h@highgearmedia.com] > Sent: Friday, June 11, 2010 1:13 PM > To: PHP General > Subject: Re: [PHP] is <?= good? > > On Fri, Jun 11, 2010 at 11:16 AM, Ashley Sheridan > <ash@ashleysheridan.co.uk>wrote: > > > For <?= to work, the short_tags setting needs to be turned > on I believe, > > which can cause issues when outputting the XML declaration > line unless > > it's broken into two parts, which is messier than '<?php echo' IMHO. > > > > Can you give an example of how this breaks? I don't see any > problems with > > <?= '<?xml blah blah ?>' ?> > > unless you are trying to validate your PHP script as XML. > Given that PHP is > *not* XML I don't know why you'd want to do that. But I've seen this > argument a few times while looking into this issue so maybe > I'm just not > seeing the big picture. ...and even *IF* it did break for that ONE instance, then simply do as I do in my xml_header.inc.php file: header( "Content-type: text/xml" ); print "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"; Problem solved. EVERY other tag in an XML document is just straight up "html" like: <foo>bar</foo> There are no other <?xml tags or anything to worry about. Again the whole XML argument seems to be exaggerated.

« previous php.general (#306059) next »