Java or PHP?
Who here would prefer Java over PHP, or PHP over JAVA?
If you prefer one over the other, for whatever reason or application, why?
Specific code comparisons are appreciated
fsn812
Junior Poster in Training
93 posts since Jan 2004
Reputation Points: 41
Solved Threads: 2
Java all the way. PHP is an invitation to messy and spaghetti code, no incentive to modular programming at all.
No separation between business and presentation code.
Basically it's very JSP 0.92 without the capability to use Java beans.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
I don't know if this will help or not. I've never used or had the desire to learn PHP, but since I haven't I can't say that it's worse or better than Java. Now, I do know a lot of Java(not compared to wenting though!). In Java, you can create desktop and web applications, which I'm not sure you can do the same with PHP. I've written some pretty powerful web applications and some powerful desktop apps. Java is cross platform so you can use it on any OS.
Another thing, Java is OO and most colleges and universities are switching from C++ to teach Java. If your young, Java would be a good one to learn if your interested in learning important concepts and intend on a programming job.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
PHP4 has been OO. PHP5 is OO, and in much better standing for OO than PHP4. PHP5 contains many of the same security in OO as Java does now (public,private,etc etc). You can use the Zend encoder to encode your PHP code, so thats not really an issue either.
I'm partial to the license provided by PHP as opposed to SUN as well.
For desktop applications though, I'd have to go with Java.
That's my two cents.
fsn812
Junior Poster in Training
93 posts since Jan 2004
Reputation Points: 41
Solved Threads: 2
While Java is an excellent language, (My formal schooling was 100% java) I will only program web-apps in php. Its faster to learn, easier to find resources for, and can be just as "clean" as java if you know what your doing. In most cases you are probably going to be using php for queries, input/output processing, and dynamic results. Well its not like there's a lot to that stuff so it would be hard to make "spaghetti-code" if you tried.
-B
bwest
Junior Poster in Training
57 posts since Jul 2004
Reputation Points: 14
Solved Threads: 1
Who here would prefer Java over PHP, or PHP over JAVA?
If you prefer one over the other, for whatever reason or application, why?
Specific code comparisons are appreciated
If looking for a nicely paid job and a not lasting developer challenging journey: Java
For corporate-level high scale, huge coding projects: Java
For programming beginners, looking for weekend freelance, just warm-up hobby programming, for personal Web sites: PHP
guideseeq
Junior Poster in Training
66 posts since Nov 2005
Reputation Points: 10
Solved Threads: 0
Java is a true programming language that supports multithreading and has more to offer. PHP is a scripting language that executes lines of code at a time. Even when you program using oop principals your still limited or in most cases utilizing many work arounds outside of PHP to accomplish your goals especially on the web. Things that you need ajax for are not needed with Java.
wrivera
Junior Poster in Training
53 posts since Jan 2010
Reputation Points: 10
Solved Threads: 10
Learn both. They both have their uses and one can do things better than the other in many cases. It also gives you the ability to choose the best language for the job.
WaltP
Posting Sage w/ dash of thyme
10,489 posts since May 2006
Reputation Points: 3,348
Solved Threads: 943