Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Differences between php and java

 
Ilh Oleo
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20555
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
K. Tsang
Bartender
Posts: 3457
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ilh Oleo
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any advice?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic