File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Differences between php and java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Differences between php and java" Watch "Differences between php and java" New topic
Author

Differences between php and java

Ilh Oleo
Ranch Hand

Joined: Feb 07, 2007
Posts: 57
Hey to all of you here at the ranch.
I want to do a question about web developing and the technology i´m using:php.
Yes i know that this is not a php forum but like i barely developed small things on java and right know i´m developing on php i want to know what are the differences between this two technologies.
And why am i asking this?
Because i´m starting my carrer and still don´t know which way to take so i´m constructing a plan.

Firstly php is a web language as jsp does but what else is on the web application world and what can be done?.
Php is a structured programming language and java is a OOP , what else?

Besides this i like anything related with security but again i don´t know what else is about security.
All what i have read is about networks but there should be something related with the security on the applications.

How could i combine these two topics?

I hope that someone can tell me what track to follow or give some advices.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Ilh Oleo wrote:Firstly php is a web language as jsp does but what else is on the web application world and what can be done?.

PHP is not just a web language - you can use it with standalone scripts as well. There is even at least one GUI toolkit for it in PHP-GTK.

Php is a structured programming language and java is a OOP , what else?

PHP is an object oriented language as well these days. Especially PHP 5 made a lot of improvements.


You know, comparing languages is a hard thing to do. There are three main types of languages (that I know of): procedural (e.g. C), functional (e.g. Haskell) and object oriented (e.g. Java, Python). Almost anything you can do in a language of a type, you can do in another language of the same type. The same holds for Java and PHP.

There is one major difference I can think of though: in Java, every variable is typed and must be declared before use. In PHP, the type of a variable comes from its value, and you can start using variables without declaring them; their first occurrence is basically their "declaration".


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1966
    
    7

I didn't know PHP can do GUI stuff.

Anyway from the web perspective, PHP is comparable to JSP/servlets/EJB (Java web) combo. PHP can also do OOP of course not as neat and good as Java.

I see the major difference between the 2 is in the app server. PHP just need Apache and Java need JBoss/Glassfish etc. Of course Apache can handle JSP/servlets using some external modules but not EJB. Apart from that speed, deployment, ease of use, etc are pretty much the same these days.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39549
    
  27
Aside from the language differences, there's the question of how a web app written in one language differs from one written in the other. Here Java (with servlets and JSP/JSTL) has a clear advantage in my opinion. While PHP may make it easier to get started, you'll be running into issues of code maintenance, application server integration, I18N, security etc. as the application gets bigger and more complex.


Ping & DNS - updated with new look and Ping home screen widget
Ilh Oleo
Ranch Hand

Joined: Feb 07, 2007
Posts: 57
Thanks to all of you.
So it´s cool to learn both languages and what about websphere,struts, hybernateand things that i´ve read.
What are those for?

And what about security?
Could i find my way to get more joy about developing but with some extras about security?
Ilh Oleo
Ranch Hand

Joined: Feb 07, 2007
Posts: 57
any advice?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Differences between php and java
 
Similar Threads
completed beta 10 feb 2005
Javascript in times to come
creating web apps
Help
Differences between scjp 1.5 and 1.6