Page 1 of 1

JAVA

Posted: Wed Mar 26, 2003 12:08 pm
by micknic
Hi guys

What are the differences between JAVA and PHP :?:


:P :lol: :o :D

Posted: Wed Mar 26, 2003 1:05 pm
by daven
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.

Posted: Thu Mar 27, 2003 4:19 am
by volka
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.

Code: Select all

public void func(java.nio.Buffer buf) { ... }
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.