What are the differences between JAVA and PHP
JAVA
Moderator: General Moderators
- daven
- Forum Contributor
- Posts: 332
- Joined: Tue Dec 17, 2002 1:29 pm
- Location: Gaithersburg, MD
- Contact:
Lots.
1. Java is compiled, PHP is interpreted
1a. No interpreter (ie--server) is necessary to run java programs
2. PHP is a scripting language (related to #1)
3. Java is fully Object Orientated, PHP is not
4. Syntax
5. Java can make non-webpage based applications. Technically so can PHP, but it is not really designed for it.
6. come to think of it, I should have just mentioned the similarities:
A. PHP and Java are programming languages
B. Both can be used in conjunction with HTTP to make web-programs
C. Both have similarity to C.
There is really not that much similarity between the languages. They are meant for different things.
1. Java is compiled, PHP is interpreted
1a. No interpreter (ie--server) is necessary to run java programs
2. PHP is a scripting language (related to #1)
3. Java is fully Object Orientated, PHP is not
4. Syntax
5. Java can make non-webpage based applications. Technically so can PHP, but it is not really designed for it.
6. come to think of it, I should have just mentioned the similarities:
A. PHP and Java are programming languages
B. Both can be used in conjunction with HTTP to make web-programs
C. Both have similarity to C.
There is really not that much similarity between the languages. They are meant for different things.
the java-vm could be considered as an interpreter as well, although there are differences. And there are tools that offer something similar to bytecode for php, too.
But one additional major difference comes to my mind: Java uses strong typing, e.g.inside the function you can be sure buf somehow is an java.nio.Buffer, the method cannot be called without such an Object. In php you can pass anything anywhere and have to check it's type inside the function.
But one additional major difference comes to my mind: Java uses strong typing, e.g.
Code: Select all
public void func(java.nio.Buffer buf) { ... }