PHP vs Java, PERL & C


  #1  
Old 03-07-04, 02:08 AM
rav12's Avatar
Member
Thread Starter
Join Date: Oct 2003
Location: California
Posts: 668
Received 0 Votes on 0 Posts
PHP vs Java, PERL & C

Can anyone enlighten me on the difference. I've never used PHP although I understand it is used quite a lot in web scripting these days. Am I right in assuming that this forum uses PHP.
 
  #2  
Old 03-07-04, 07:27 AM
C
Member
Join Date: Nov 2001
Location: Taylors, SC
Posts: 9,483
Received 0 Votes on 0 Posts
I am not a programmer. The explanation would be akin to the ins and outs of home decor.

Suffice it to say that they are different programming languages. This is a distilled version of my take on it all.

Java is a cross-platform environment that will run on any operating system that has Java installed. In other words, the same program will run on Windows and Linux.

PHP and Perl are generally scripting languages or used to create scripts that run on the appropriate platform to perform certain tasks. For instance, a web site needs a hit counter to track visits. The site owner might install a Perl script to perform this task. PHP is used in much the same way.

C and C+, ++ are programming languages. Along with the others, they can be used to write entire applications.

Some programmers use one or the other out of preference or need. Everyone seems to like or dislike one or the other for all the same reasons. There is much more to all the various programming languages and how and when they are used.

I have read books on the various programming languages. Since I don't use them for anything I don't have a feel for any of the fine points.

If you have an interest in one or the other of them, you might check into a web site or book dedicated to it. There might be a walk-through for the unitiated. As I said, I have read the books. I don't know the languages and all the applications.

Hope this helps.
 
  #3  
Old 03-07-04, 09:52 AM
Pendragon's Avatar
Member
Join Date: Jul 2002
Location: USA
Posts: 1,851
Received 2 Votes on 2 Posts
Since it seems you are comparing languages for use on the internet, I'll go by that.

Java is a platform independant language, as long as the machine has a java interpreter, the same program written for a Mac will run on Windows, Linux, etc. Java is a client side language.

Perl is a scripting language used mainly for the internet now (though that wasn't it's initial purpose). Perl is a server side language, meaning the server actually runs the program.


Php is also a scripting language used mainly for the internet, many web apps use php over perl because php supports MySQL databases natively, and that functionality is easier to program into Php than into Perl.

Java, Perl and Php are uncompiled languages, they are compiled each and everytime they ran by the machine running.

C is a platform based, compiled language, it's compiled once, for the platform it's written for. C can also be used for web applications. C is often used for high volume, database driven web applications for speed and simplicity.

Perl and C can be compiled into standalone executables, Php and Java cannot and are totatally dependent on either the Client (Java) or the server (php) for compiling.
 
  #4  
Old 03-07-04, 12:46 PM
rav12's Avatar
Member
Thread Starter
Join Date: Oct 2003
Location: California
Posts: 668
Received 0 Votes on 0 Posts
Pendragon – excellent summary. I do slightly disagree with one thing and that is the part about the platform independence of Java. While this is true it also should apply to the other high level languages listed here – this is the very reason they are considered “high level” so that the programmer does not have to worry about the platform’s architecture be it Pentium, Itanium, SPARC or whatever. Of course anyone programming in a native assembler language would have to know about the given processors architecture and is of course assembler is used heavily in programming embedded micros, signal processors etc.

I guess I did not fully clarify my original post. I guess I was kind of looking for what PHP offered as a language in terms of constructs etc that would give it an advantage (if any) over the others – not necessarily for web based apps. However, I understand that it allows HTML to embed PHP invoking commands to invoke a PHP script as opposed to PERL where (at least based on some CGI programming I did in the past) you have to use PERL to generate the HTML on the fly in response to some sort of POST command from the client side.

You are quite right about PERL being a general purpose scripting language – it is used among other things to run synthesis scripts while designing ICs.

My interest in PHP was raised when I received an ebay “spoof” email yesterday. It is the first time I received such an email. In addition to forwarding it to ebay for investigation I also did my own analysis on it. The headers and domain name lookup showed it originated from an ISP somewhere in WA and the embedded Javascript was designed to run a PHP script on a remote server being used to harvest people’s personal information. Interestingly when I tried to access the server running the script via http the message form the ISP said it had been closed down.

So, I would also like to remind anyone reading this thread to be alert for any emails asking for personal info. I have to say that it had me fooled for a moment as it had all the correct ebay icons etc.
 
  #5  
Old 03-07-04, 03:54 PM
S
Banned. Rule And/Or Policy Violation
Join Date: Nov 2002
Location: Atlanta, Ga
Posts: 2,691
Received 0 Votes on 0 Posts
I've gotten that same e-mail - I also sent a note to Ebay about it.
I visited the page, only out of curiosity, and sure enough, it looked just like Ebay.

The PHP in that e-mail is just a webpage - much like the one you are viewing now.

I use PHP in most of my webpages, only because, as you mentioned, it allows HTML to be placed inside the scripts. Actually, you can turn PHP on and off just like Java right inside the files (using "< ? php" and "? >" - no spaces) - so it's very easy to learn and implement.

As Pendragon mentioned, PHP is mostly used for it DB functions and integration with MySQL and many other DB structures. After all, what easier way to setup a dynamic site than to use MySQL, instead of flat files.

I've never used ASP, but from my understanding, PHP and ASP are similar languages.
 
 

Thread Tools
Search this Thread
 
Ask a Question
Question Title:
Description:
Your question will be posted in: