Love it or hate it, PHP will be around long after elitist devs turn their guns on noSQL and server side JS.
I don't know of many "template languages" that treat classes as first-class citizens, has an in-depth, thorough unit testing framework, traits, closures, and and and.
I'm sure you get my idea? PHP may have been much simpler at its inception - it is not the same beast now.
I hate when PHP pops up here on HN, 90% of the people flapping their gabs don't or haven't used PHP for many many years, and when they did it was some Indian's crap code so they spend their time talking shit about a language because they had to fix a bug in Hinderbar's PHP spaghetti from 2003.
Everyone is capable of writing crappy spaghetti code.
For example, say I want to plot a couple of data columns with gnuplot (an open source plotting program) into several images. I can write a PHP script "myplot.plt.php" that generates a gnuplot script (untested):
set terminal png enhanced
<?php
for ($i = 2; $i <= 4; $i++) {
$outputfile = "plot$i.png"
echo <<EOT
set output "$outputfile"
plot "data.txt" u 1:$i
EOT;
}
?>
and then invoke it from gnuplot with load "< php myplot.plt.php"
This is a stupid example, but it gets really powerful when you dynamically calculate labels, element positions, etc.. PHP may be a crappy language for web development, but it is a really nice macro language, and has really powerful string processing features, making it ideal for this kind of hack.Basically it stipulates that you should keep classes outside of the main page loader to be compliant.