0

Possible Duplicate:
What are the differences between PHP and Java?

Hi all Somebody said "PHP is dynamic, dynamically typed, functional, interpreted language". If somebody can tell for each of this characteristics whether it is true or false, and why, it would be greatly appreciated. The same for Java what are the characteristics?. Thanks in advance, and looking for a proper answer to accept.

Community
  • 1
  • 1
Centurion
  • 5,169
  • 6
  • 28
  • 47
  • 2
    Sounds like an interview question or homework – Pekka Nov 09 '10 at 14:12
  • Whatever that means, yes, not really and yes. Is this homework? Would you mind expanding your question and telling us where you think your understanding about the subject is lacking? – deceze Nov 09 '10 at 14:14
  • No, I am switching from PHP to Java so I would like to know the differences from the beginning, even if i understand somehow all this but not fully. – Centurion Nov 09 '10 at 14:14
  • Also Wikipedia answers all of these questions. – mario Nov 09 '10 at 14:14
  • 3
    In that case it's a duplicate of [What are the differences between PHP and Java?](http://stackoverflow.com/questions/411254/what-are-the-differences-between-php-and-java) – deceze Nov 09 '10 at 14:15
  • This is standard textbook material. Google is your friend. – bcosca Nov 09 '10 at 14:15
  • @ deceze, Thanks, but your link is showing some practical differences, but I would like to better understand and distinguish those 4 characteristics.. – Centurion Nov 09 '10 at 14:19
  • deceze: Is Java classed as an interpreted language? I think you could make the argument that "interpreted" now means "interpreted from source" – seanyboy Nov 09 '10 at 14:21
  • Most of these terms don't really mean a lot to begin with, or their meaning is murky or open to interpretation. You can read [Wikipedia](http://en.wikipedia.org/wiki/Comparison_of_programming_languages) to see if some of these terms are used to describe a language, but it really won't tell you very much about the language until you've had some experience with it. I think the question I linked to contains much more valuable information. – deceze Nov 09 '10 at 14:24

3 Answers3

1

PHP:

Interpreted: yes (but PHP is not compiled)

Dynamically typed: yes

Dynamic: yes

Java:

Interpreted: yes (but Java is also compiled)

Dynamically typed: no (Java has static typing)

Dynamic: no (Java is system language)


Functional: not sure whether this term means what I think it means. But I would say both PHP and Java are functional languages.

Richard Knop
  • 81,041
  • 149
  • 392
  • 552
  • Thanks for enlightenment, but what means system language, php can also interact somehow with system, as I know maybe I'm not right though. – Centurion Nov 09 '10 at 14:23
  • 1
    The term "dynamic" describing a language is not as precisely defined as it is for dynamic binding, dynamic typing, or dynamic scope. It makes a general distinction between things occuring at run-time or at compilation. PHP is certainly more dynamic than Java in this sense, but where to draw the yes/no line is debatable. – jon_darkstar Nov 09 '10 at 14:28
1

Functional - I take this to mean in the sense of functional, declarative, lambda/applicative programming.

PHP has some functional elements (lambda's, higher order functions like array_map, filter, reduce, etc) but it still primarily an imperative language. PHP is NOT a functional language.

Java is even further from a functional langauge.

jon_darkstar
  • 16,398
  • 7
  • 29
  • 37
  • http://en.wikipedia.org/wiki/Functional_programming if you are curious about functional programming. A few such languages are Lisp, Scheme, Haskell, and ML – jon_darkstar Nov 09 '10 at 14:24
1

Java is compiled and then interpreted. It's statically typed, but in a dynamic way. It has functions, but is not a functional language.

seanyboy
  • 5,623
  • 7
  • 43
  • 56