Hacker News new | past | comments | ask | show | jobs | submit
> PHP was a joke language from the start

I am no fan of PHP but it wasn't really a joke language. Its goal I think was to add some dynamic snippets to your homepage for which I guess it served its purpose pretty good. PHP even originally stood for Personal Home Page iirc. The problem seems to be that the rest of the language was built on top of that. I haven't used PHP in over a decade, so I don't know if it's still the case, but you used to start a PHP file with a PHP opening tag, which is such a weird "feature", but I guess kinda makes sense in a world where everything outside of PHP tags used to be HTML.I remember seeing PHP files that were impossible to work with: thousands of lines with HTML mixed in with PHP classes etc.

It's been a while for me as well, and I don't know what's original and what's a backronym, but the well-known "PHP Hypertext Preprocessor" name is sort of part of the answer. The "weird \"feature\"" is central to the point of PHP, which you sort of mentioned, just overspecified as dynamic snippets instead of reusable snippets generally. Since a php include() could (and very often did) pull in things like HTML (page templates) or CSS (pre-SASS/LESS/variables) it was necessary, or rather natural, to explicitly invoke PHP (invoke it again, even, separately from the tag preceding the include statement).

This was the tradeoff (or should I say trade-up) for going from

    #!/usr/bin/perl -w
    use strict;
    my $username = <>; 
    chomp($username);
    # blah blah blah blah blah
    print "<html>\n<head>\n[...]<body>\n";
    print "<p>Hello, " . $username . "!</p>";
    print "</body>\n</html>"; 
to

    <html>
    <head>[...] 
    <body>
    <p>Hello, <?php echo $username; ?>!</p>
    </body>
    </html>
(Of course, as you point out, we promptly recreated the former situation in PHP -- but maybe there was some rationale to it? I wouldn't know; I did my best to avoid that kind of overwrought PHP project)
Happy to see people who still know Perl around. Mojolicious is still a thing, by the way.
Lol, thanks, but I only wish I could pull off wearing the P.I.M.P. shirt.¹ I've always been fascinated by the whole culture of it, but I wouldn't say I really know Perl, even if I once cobbled together a working irssi extension.²

Anyway, for (hopefully) your enjoyment, here's my best fizzbuzz golf (but not the best):

    for$n(1..100){$\=$/;$n3=$n%3;$n5=$n%5;print!$n3&&!$n5?fizzbuzz:!$n5?buzz:!$n3?fizz:$n}
1. https://i.vgy.me/X8Rdpk.jpg

2. Really cobbled, and in all seriousness that's why I say I don't know Perl (I only did any of this stuff with very heavy reference to documentation and no real sense of orientation at all)

bonus: https://i.vgy.me/Q5qIIP.png