in reply to php + Smarty looks like CGI

I can't see any benefits that speak for PHP for myself, but clearly there's a lot of people out there that do. And I believe it doesn't have to do a lot of PHP being "better" than Perl, or, for that matter, vice versa.

A lot of people comment, and I agree, on how they love Perl because it matches the way they think and solve problems so well. I guess it is only logical to conclude that there's a lot of people that find that PHP/Visual Basic/Java/C#/... match their way of solving problems well. They will find the problems you found with PHP insignificant, and instead will take issue with some things in Perl that never occured to you to think about.

Of course, deep inside I admit to thinking that Perl, after all, is better :). However, I find that when dealing with people that don't want to dabble with Perl for whatever reasons, it is not my attitude that convinces them -- but rather the way I use Perl to get the job done. And of course, sometimes there's situations where you just have to let people not use Perl.

Replies are listed 'Best First'.
Re: Re: php + Smarty looks like CGI
by Theo (Priest) on May 18, 2003 at 01:10 UTC
    As a newbie to both PHP and perl, I'd like to see a truly objective (Note: may not exist) comparison of the two. I think there must be areas where one has strengths over the other. If any such comparisn exists, though, I've yet to find it.
      I've written what I hope to be a fairly objective comparison of Perl and PHP in Re: Preaching Perl gospel to PHP converts.... But further to that here's a simple list of the various differences between the two languages

      Perl PHP
      Language features
      Lexical scoping and dynamic scoping Functions have unique scopes
      3 different contexts (scalar, list, void) No context types
      5 different sigils - $,@,%,&,* One sigil - $
      Regular expressions part of the language Regular expressions accessable through functions
      Data
      Scalars, Arrays, Hashes Scalars, Arrays/Hash duality
      Type-ignorant with roughly 3 types (string, number, reference) Type-ignorant with roughly 13 different types (see. is_ functions)
      Explicit references Optional explicit references
      Pass by value Implicit (i.e it should do the right thing)
      Functions
      Can be called with 3 different syntaxes Called with one syntax
      Anonymous functions part of the language Anonymous functions from create_function
      Can be referenced Symbolic calls
      Args implicitly aliased to @_ Named args
      Objects
      Created through blessing a reference Created through new Class
      Multiple Inheiritance Single Inheritance
      Class variables aren't standard Class variables part of the language

      This is by no means exhaustive or entirely accurate but should give you some ideas of the fundamental differences between the two languages.
      HTH

      _________
      broquaint

        1. "Pass by value"? ' Don't think so.

        sub addOne { $_[0]+=1 } my $x = 1; addOne($x); print $x;

        It's the assignment to the lexical variables that makes the parameter passing look like "pass by value".

        2. "Class variables aren't standard"
        What do you mean by this?

        Jenda
        Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
           -- Rick Osborne

        Edit by castaway: Closed small tag in signature

        Thank you for your Perl/PHP comparision chart! I just now learned how to read responses to my postings or I would have replied sooner. Again, Thanks!