Reprinted from: http://bbs.csdn.net/topics/370028531
For more than 6 years Java development, the twilight look back, found that PHP also listen to attract people.
Recently, more than 70 oceans bought a book called "PHP Bible" to start learning PHP, and now to make a simple comparison with Java:
1, code: Java is more beautiful. PHP has operators such as "::", "__set", which is not in Java.
2, Object-oriented: Java is an old-style object-oriented programming language, better than PHP. A file in Java is a class (in addition to the inner class), so the class hierarchy of Java is clearer. PHP class in the __get, __set and Java getter, setter comparison, because I am not familiar with the PHP framework is not commented, Java programming getter, setter is widely used in various frameworks, simplifying the development work.
3, Mode: Java has a variety of programming modes, there are interface-oriented programming, AOP,IOC. PHP Introduction mode of the book relatively few.
4, Framework: Java's various frameworks abound, ranging from MVC to ORM to spring's versatile components. PHP has the zendframework I know.
5, Function: the development of Web applications, Java can be implemented by PHP can be implemented, this is where PHP attracts me. Desktop apps and mobile apps will be out of PHP.
6, Deployment: PHP is much easier than Java, and the market support for PHP virtual host also more expensive than the JSP host. Compared to using PHP and Java to feel like Windows and Linux, of course, Java development of small applications is not difficult.
Summing up, PHP after so many years of development, is maturing, but also with Java to develop efficient distributed applications. Welcome to Add.
--------------------------------------------------------------------------------------------------------------- ------------------------
Comments:
1, Java is in the class, so do not need "--" to represent the object members; PHP "." be used for another, so you can't use "." expressed. Java has a namespace, so there's no need for "::" to represent the source of the method
2, PHP from the beginning is the process-oriented, although the need to jump Nest Java programmer, added the object-oriented components. However, PHP's operating environment and methods determine that PHP is not suitable for using classes with more inheritance levels. PHP class __get, __set and Java in the getter, setter role is quite
3, the mode is a theory, a method, in PHP can also be used, but not mechanically
4, the framework is the application template. PHP also has a variety of frameworks, but Java is far more extensive than PHP. Natural Java has more frames than PHP
5. PHP was developed for Web applications from the beginning. Easy to use is his feature, and PHP's fault-tolerant features rather than your Java programmers criticized as "not rigorous"
Comparison between Java and PHP