Comment by nirui

18 hours ago

If I remember it correctly, the "Java-lite" part comes rather late. PHP was more close to Perl and/or other old-days scripting language, it allows you to quickly launch a web page. Just

    <p><?php echo(htmlspecialchars($_GET['user'])); ?></p>

and you get a hello page with a parameter specifiable via `?user=` query.

But then people started to actually use it to build big sites, `echo($_GET['user'])` alone is not enough, it has to be:

    <?php
    $user = "guest";
    if (!empty($_GET['user'])) { // Have to remember to do this check everytime when handling $_GET/$_POST etc
        ... safety check etc etc
        $user = htmlspecialchars($_GET['user'], ...more parameters...);
    }
    ...

So people started to add module/components as well as ways to load and use those components, to enable them to write code like:

   <?php

   use My\Beautiful\InputFilter;
   use My\Beautiful\InputFilters\Integer;

   function get_page_num_from_query(InputFilter $f, array $source, string $name): bool {
     return $f->is_valid(new Integer(0, 100), $source, $name);
   } // Or something like that, hasn't write a single line since PHP5.

That's when it got it's Java look.

>That's when it got it's Java look.

Nice Java burn! But now days all you have to say to burn Java is "Lawnmower".