A lot of these decisions are based on "what will pay the bills today and in the immediate future?" rather than purist idealism.
A lot of businesses use Java. Java experience is more useful for getting into mobile app development with Android. There's value to be had in learning and writing Java. But the demand for PHP doesn't cease to exist because Java is cool or useful.
https://w3techs.com/technologies/overview/programming_langua...
PHP has vastly out-lived its welcome. I'm not saying Java is immeasurably better, it's got a whole different set of problems, but it's an example of a language that's got a better tool-set than PHP ever will.
The debugging tools for Java are really amazing because writing good, threaded Java code can be wickedly hard. The tools for PHP are absolutely anemic by comparison because it's never had the same exposure to enterprise environments.
I'm no fan of Java, but if you're writing Java, you may as well write Java.
'used to be' being the key words here. PHP is __still__ being used.
> PHP has vastly out-lived its welcome.
Care to explain why you believe that? C is older than PHP and is still around.
> but it's an example of a language that's got a better tool-set than PHP ever will.
Don't know about the PHP toolset you have been using, but I take Composer over Maven any day. If you are talking about IDE support, PHP7 IDE support is as good as Java IDE support. Can you give me examples of tools that are better in Java?
> The debugging tools for Java are really amazing because writing good, threaded Java code can be wickedly hard. The tools for PHP are absolutely anemic by comparison because it's never had the same exposure to enterprise environments.
PHP web applications use a process-based model, therefore debugging threads is irrelevant.
> I'm no fan of Java, but if you're writing Java, you may as well write Java.
I recommend you try out the latest Spring framework(Java) and then go try out the latest Symfony(PHP) and you'll see why you would want to use PHP in some cases despite it having similar OOisms.
2 of my favorites are https://getcomposer.org/ and https://laravel.com/
Edit: that's not to refute what you've said or anything.
Composer and the PSR initiatives have totally changed the feel of working in this ecosystem for the better.
PHP is catching up to what other languages have enjoyed as a given for over a decade. It's very confused. There's been absolutely zero effort to overhaul the core PHP API which is, on the whole, absolute junk. Frameworks like Laravel do their utmost to insulate you from having to use it too much for the ugly things.
As an example of what could happen, JavaScript has gone from this ugly, useless language that would crash your browser if used too much to something that's now widely deployed and powers significant web properties both client-side and server. The improvements to the language have been dramatic, ES6 code is words apart from JavaScript 1.
In another 5 years JavaScript will hit another milestone, Java will evolve, and PHP will still be PHP.
If you were involved with the internals team at all, you would know this is not true.
Was released in 2013.
> Laravel is a "at least it's not garbage" framework.
How many PHP frameworks do you actually know?
> Find something in an array?
One function call(PHP 4 >=): http://php.net/manual/en/function.array-search.php
> PHP is catching up to what other languages have enjoyed as a given for over a decade.
Can you list the things that Java and JavaScript had for over a decade before PHP?
> which is, on the whole, absolute junk.
Do you have proof of this?
> Frameworks like Laravel do their utmost to insulate you from having to use it too much for the ugly things.
Just like frameworks in any other languages.
> JavaScript has gone from this ugly, useless language that would crash your browser
Have you seen the amount of JavaScript modern JS frameworks generate? We are now in the megabytes.
> deployed and powers significant web properties both client-side and server
PHP powers the worlds biggest social network, what's your point?
> The improvements to the language have been dramatic, ES6 code is words apart from JavaScript 1.
There was also a decade of inactivity: https://en.wikipedia.org/wiki/ECMAScript#Versions
You have to use transpilers if you are planning on running it in the popular browsers even for ES6.
Even the latest versions of JS retain the brain damage from older versions(for backwards compatibility).
> In another 5 years JavaScript will hit another milestone, Java will evolve, and PHP will still be PHP.
It took JS more than a decade for it to get support for classes, I wouldn't hold my breath.
1) highly complex (and long!) build processes
2) memory issues: I have yet to see a reasonably complex Java application, both desktop and web, use a reasonable amount of RAM. Also, the fact that the JRE is long-running inevitably leads to memory leaks whereas in PHP every request and its environment get torn down at its end
3) overabstraction and literally hundred-lines-long stack traces which make debugging next to impossible. However, the trend seems to be heading this way in PHP too, so I don't know how long that advantage still holds.
Definitely true. Laravel has this issue with the added bonus of magic methods and Facades all over the place.
- Existing Java frameworks and libraries are difficult to obtain and maintain and difficult to work with (PHP libraries/frameworks are available in central repository - packagist, and are on github)
- Not much difference in performance - because most operations are IO bound in web context - also, PHP extensions are implemented in C - so you could implement your performance-critical parts as a C extension (or if your architecture allows it, in any other language and run as a different service communicating async with your application)
The amount of boilerplate in "good" Java code is substantial (like 20-30% more lines) compared to "good" PHP in practice. At least imho/experience.