Rick Widmer wrote:
I agree with you on the simplicity thing but I guess you've never tried writing an XML script in PHP. It is more complicated than it needs to be.
I fail to see how using <?php is "better coding practices". Unless you
plan on distributing your code to the masses or mixing XML/XHTML without
trivially escaping it, I see absolutely no point in using <?php over <?.
In reality, very few people intermix PHP and XML. It just doesn't make a
whole lot of sense to do so. People tend to keep the two separate and
parse the XML from PHP.
In the XHTML case, a lot of people mistakenly believe that they must start
their documents with an <?xml encoding=...?> tag, which if you read the
XHTML spec, is actually not necessary. The only use for the XML encoding
tag is for XML parsers to get the right character encoding. Browsers,
which are typically the target of PHP generated pages, get their character
encoding from the Content-type header, or optionally from a similar meta
tag. But even if you choose to put in the XML encoding tag, I find it a
hell of a lot easier to just put <?echo '<?xml encoding="foobar"?>'?> at
the top instead of changing hundreds of <? tags to <?php
PHP became popular because it eliminated most of the tediousness of
writing CGI scripts or low-level Apache modules. If we slowly but surely
eliminate all the convenience aspects of PHP we are going to turn the
experience back into one of tedium again.
There seems to be a very common thread here. People who are kicking and screeming about making PHP XML-compliant are not the least bit interested at entertaining the idea that XML may become popular amoungst PHP application developers in the not too distant future (aka, version 5). This, dispite all the wonderful work that has gone into plugins such as Sablotron, expat, and DOM xml.
PHP is not a pure language. It never will be. The problem it solves is
ugly. Ugly problems often require ugly solutions. Solving an ugly
problem in a pure manner is bloody hard. PHP's aim is to make solving the
web problem easy. Ergo, therefore, Q.E.D, removing all the "ugly"
features of PHP is going to make it harder and harder to use PHP to solve
the web problem.
I suppose that most of the experienced people amoung us have been doing PHP development for a while now so most of that work would be in HTML (where standards have been largely unsuccessful). To that end we come away content with what we have (nice comfort zone) and reluctant to change. We also come away with a healthy skepticism of standards and a deep belief that web standards will always be futile.
I would hate to see PHP's simple but awsome application producing capability essentially *crippled* (or at least stifled) when XML becomes the norm because inter-application functionality (such as SOAP for only *one* example) is essential as the web landscape evolves.
So if standards are the "baby" and the extra 3 charactes are the "bath water", then lets not throw the baby out with the bath water because we've been jaded by past experiences with failed standards implementation.
And if we do ignore this issue, it *will* return and with more and more frequency as PHP enthusiasts embrace a new way of encapsulating and exchanging their data. Maybe the reason that this issue will not go away is because PHP has a bug in it which is called "short_open_tag". THIS ISSUE IS NOT GOING TO GO AWAY if this bug is not squished. To pretend that it will is sheer ignorance.
Please, people, when all of you make your comments, please considder what will be thought of them in 2 years time.
kind regards,
Terence.
<LOUD CHEEER!!!>
<tired sigh>
Rick
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php