[Za-pm] Re: Za-pm digest, Vol 1 #15 - 1 msg

Oskar Pearson oskar at qualica.com
Mon May 26 04:21:56 CDT 2003


Hi

> Yah, well ... No, fine!
> Beginnings are always somewhat slow. There's something that's been going
> through my mind, though: perl vs PHP.
> 
> Being a permanent "perl beginner", I haven't had much time to penetrate
> the language very deeply, never mind investigating PHP and its
> usefulness. What I gather is that PHP is some kind of html scripting
> (presumably much like JavaScript). On the other hand, there must be a
> few people in this group, who have had experience with both scripting
> languages (perl and PHP) to be able to provide a bit of a comparison.
> i.e. when is it useful to use PHP, why not integrating both scripts
> (which I'm sure many people do), is there anything you do with PHP that
> cannot be done with PERL, etc.
> 
> Apology in advance for the naive suggestion, since I suspect that most
> of the subscribers to this group have subscribed because they hate PHP
> or they feel that, in most situations, PERL beats PHP hands down.


PHP is not really like javascript.
Javascript runs in the browser itself: web pages with embedded source
are served to the browser, which then runs the code in the pages.

PHP runs in the server. It determines what is in the web pages it serves
before it even gets sent to the client. It can, of course, serve javascript
to the client, which can then run it.

It's akin to CGIs (not sure of your level..) - it's just faster than running
a program from the ground up - the interpreter is always in ram.

PHP is akin to mod_perl in this way: it's in the server, and serves the
data without having to load the interpreter each time.


I've done programming in both perl and php (the latter years ago). I like
perl over php because:

1) libraries I write in perl can be used from the command line easily:
I can write a library and use it in a cron job and in a web page.

2) php programmers generally have a poor idea of the seperation between
code and interface. They put db queries straight into their table
layout code and other such things. I'd much rather have a clear template
library that does simple variable substitution, and keep all the logic
in the cgi equivalent.

Just my view, of course. If you write php code with reasonable seperation
(we do) then the latter is not such an issue.

Technically, I think most programming languages are getting to be
very close in terms of speed, memory usage, efficiency, and other such
things... so there are less and less technical reasons to worry about
one over the other.

Oskar
--
Oskar Pearson <oskar at qualica.com>
Qualica Technologies (Pty) Ltd
web: http://www.qualica.com/



More information about the Za-pm mailing list