Either short tags would be disabled and cause an error. Or nothing would happen.
<?php echo date('Y-m-d')?> -- Would be most preferable.
<?=date('Y-m-d')?> -- Won't work on half of webservers.
PHP is simple but most PHP servers are terrible. Part of my job is to ensure the smooth installation of proprietary software on around 1000 servers a year. This is the painful part of PHP development. If the client is paying less than $5/mo for hosting then I often run into problems with misconfigured servers, common features being disabled.. hell.. shit not working! Why isn't it working? I don't know. There are no errors. There is nothing logged... yet for some reason the session only lasts 7 seconds before disappearing.. yay!
I love PHP because it is simple and just works... I really dislike 80% of shared hosting providers who cause all sorts of problems with what should be a simple cross platform application.
"<?=date('Y-m-d')?> -- Won't work on half of webservers."
You're referring to shorttags, and how evil they are. Firstly, PHP 5.4 enshrines this echo shortcut usage, and they'll always be on from now on. <?=$something;?> will always work from 5.4 on.
Secondly, "half"? Where the hell are these mythical 50% of web servers that actively disable short tags? I've been working with PHP since 1996, have worked on hundreds of projects on dozens of hosts - shared and dedicated - over those years, and have come across this once, on a server managed by someone who compiled everything by hand (not just PHP, but everything) and felt turning short tags off was "optimal" because he'd read it somewhere. He wasn't a PHP dev, just had read 'short tags are bad'.
I don't doubt that some admins and hosts do turn off short tags. It is no where close to 50% of servers out in the wild though. 5% perhaps? Even that, in my view, would be a huge stretch.
Surely you realize that PHP is alone in having vast swaths of its common functionalitity disabled by hosts because of massive security problems arising in actual use?
This means PHP being crippled on many servers is PHP’s own fault.
Not necessarily. Popularity makes something more likely to be exploited. Compare PCs to Macs re: viruses. Also, many security issues were due to conventions in early versions of the language, e.g. register globals.
Would whiff...
Either short tags would be disabled and cause an error. Or nothing would happen.
<?php echo date('Y-m-d')?> -- Would be most preferable.
<?=date('Y-m-d')?> -- Won't work on half of webservers.
PHP is simple but most PHP servers are terrible. Part of my job is to ensure the smooth installation of proprietary software on around 1000 servers a year. This is the painful part of PHP development. If the client is paying less than $5/mo for hosting then I often run into problems with misconfigured servers, common features being disabled.. hell.. shit not working! Why isn't it working? I don't know. There are no errors. There is nothing logged... yet for some reason the session only lasts 7 seconds before disappearing.. yay!
I love PHP because it is simple and just works... I really dislike 80% of shared hosting providers who cause all sorts of problems with what should be a simple cross platform application.