PHP vs Perl (Put on flame proof gear)

Ross Werner ross at indessed.com
Sat Mar 18 13:01:08 MST 2006


On Sat, 18 Mar 2006 11:34:49 -0800, Stuart Jansen <sjansen at buscaluz.org>  
wrote:
> On Sat, 2006-03-18 at 12:12 -0700, garth h wrote:
>> > And perl and PHP *really* aren't /that/ different. (Oops, I hope I >  
>> didn't just fan the flames.)
>>
>> Is that a joke?  Have you used both languages?
>
> That said, there is a fair amount of similarity
> between Perl and PHP. Part of that is because the first version on PHP
> was written in Perl. Both language have a large number of builtin
> functions in the global namespace.

That's funny, this was one of the things I considered to be a significant  
difference between the two languages. According to  
http://tnx.nl/php#bloat, PHP has 3079 functions in the global namespace  
vs. Perl's 206.

> Both are largely imperative. In both
> languages, objects were more of an afterthought. The problem is, PHP
> ends a few details after that. Dig into Perl and you'll discover two or
> three parallel universes.

I agree that there are a few "parallel universes" in Perl-land, but  
honestly I haven't seen them utilized in any large-scale (especially web)  
applications. They're mostly written in the same largely imperative,  
C-style manner that PHP programs are written in.

> (Without even getting into variables like $@ $_ $^ etc.)

I don't really consider those special variables to make the language that  
"different"--for the most part, they're syntactic sugar with an easy 1:1  
mapping to common patterns in other languages. A bigger difference I think  
is the functional aspects of Perl (like map() or grep()) which, AFAIK,  
have no real counterpart in PHP.

	~ Ross



More information about the PLUG mailing list