Which is better Java or PHP?
First I would say it depends on what you need from programming language. This question can be split into 2 questions: "Where Java is better than PHP?" and "Where PHP is better than Java?". So, let's start from the first one:
Java would be better choice than PHP in following scenarios:
1. You need multi-purpose language, not just for web app, but for android development, client development etc.
2. You need to created multi threaded application to use CPU as much as possible. Example would be multiplayer game server.
3. If you want to develop efficient automated programs like periodically generating reports, working on heavy services, image or video processing.
Some popular Java Frameworks are: Spring, Hibernate, Apache Kafka, Play.
PHP is better choice than Java if you have following requirements:
1. You want to learn quickly and start developing then PHP is much easier than Java, both learning and developing in PHP is faster than Java.
2. If your only goal is to make simple websites then PHP is a way to go: the most of simple websites built on Wordpress - which is a PHP project.
3. If you want to find small jobs as a freelancer, most of small businesses use PHP because it's widely adopted for simple websites and landing pages.
Some popular PHP frameworks are : Laravel, Codeigniter, Zend, Symphony, Yii 2, CakePHP
Major Technical differences between Java and PHP are: Java is compiled language, where PHP is interpreted language. Java has strict type checking, PHP doesn't have (you can assign Integer to String if you want). There are some other differences when it comes to compare technical details.
Actually both programming languages are very valid and really good, as the article we explain to the task of choosing use is because it adapts better to what we want to use it, for example I prefer to use in almost all cases the JAVA although is difficult to interpret when finishing the algorithm gives me a better response and better visibility. I also use PHP but for simpler things to create a page or blog I like to use more this. If both options are good our choice will depend on the tools we need to develop what we want. On the other hand it is important to note that the advantage that PHP has is that it has greater compatibility with many functions, while Java can present some flaws in some areas of application. however I still choose the java programming language because as I said it is dynamic and has a good interface at the end time
I guess PHP is more popular.