Want to squeeze performance out of your servers, Java is a better fit than PHP: bit.ly/2sSircR
I've built batch processing systems that decrypts and processes data, PHP took 8 hours to process 10000 entries. I rewrote that PHP code in Java within a day and managed to process 250000 entries in 5 minutes - huge difference and customers could actually use the service, unlike the PHP version which several developers spent weeks trying to optimize and tune it to run faster.
Java you can run serverside, compile to JavaScript so that you can use it in the browser, run on mobile as well as embedded devices. PHP you're mostly limited to running serverside. You options for Java frameworks and libraries is also huge compared to the limited number of libraries available for PHP.
PHP is single-threaded, so where I can spawn threads to get more stuff done faster, PHP simply can't do that. Java I can spawn a thread for each database query if if I wanted to, or even throw it in a thread pool which has a connection pool which allows much better throughput. In PHP if the DB is slow, everything has to wait for the response from the database.
PHP language is pretty much broken in every way imaginable, once you start using other languages, you'll actually realize this: eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design
blog.codinghorror.com/the-php-singularity
Java, if you don't like the syntax, you can hop onto other languages which still runs on the Java Virtual Machine like Jython (Python for JVM), JRuby (Ruby for the JVM), Scala, Clojure, Groovy, Kotlin (my favorite JVM language), etc. Either way, non of the options are as badly designed as PHP and you'll actually get a good night's sleep instead of wondering, do I send in the needle first or the haystack first.
As an ex-PHP developer myself, my advice is to try Java or even Kotlin if you don't like Java's verbosity. You'll probably hate it at first, but eventually you wouldn't want to go back to PHP's quirkiness.
Java was and still is the preferred native language of Android development so... there's that "uselessness".
I know many companies, some friends work for, that use Java as their primary app language. Same as some others have said - right language for the right problem.
different purposes -> different languages. I don't go for those religious things.... but PHP != Java != JS != Ruby != ....
write a desktop app in PHP ;D .... sure you can do it .... but probably you should switch to another language for that.
And the most important thing .... every language you know helps you understand other concepts. So stop being religious learn the overcomplicated hyperabstraction of java and than kick it for <please insert language here> and learn the next one.
All languages are built on models -> All models are wrong -> but some of them are usefull..
understanding paradigms helps you improve your programming skill.
Marcus
Full Stack Developer
Ipseeta Priyadarshini
Software Developer
In the first place, you need to decide what are you trying to build. No programming language is useful or useless, it all depends on the perception of the individuals who intend to learn these languages.
Do you want to work with the web or do you want to be working on desktop and native mobile apps? With PHP you'll only be developing for the web where as with Java you can do both.