in reply to PHP vs Perl code compare

I find comparing two languages with "toy scripts" to not be very exciting. You are not going to really see the strengths and weaknesses until you delve deeper. Consider how database and interface abstraction layers influence your decision. That's where the excitement begins. ;)

I have been coding in PHP for the past week and so far ... it's not so bad. I have been using the Smarty templating engine and have been having very good results.

Why am i using PHP? First, because the original site was written with it. Second, my client wants PHP. Personally, I would rather use mod_perl, but (for me so far) PHP has been more fun than JSP, ASP, and Cold Fusion combined. If you are serious about PHP, i recommend O'Reily's Programming PHP and Smarty. PEAR looks promising as well.

What have i found the differences/similarities between Perl and PHP to be so far?

All in all, i can't really knock PHP, but if i have a choice - mod_perl!

jeffa

Blessed is the PHP programmer who grokketh Perl.

Replies are listed 'Best First'.
Re: (jeffa) Re: PHP vs Perl code compare
by fruiture (Curate) on Oct 28, 2002 at 12:01 UTC

    Just one thing: You say PHP supports anonymous subroutines, but sadly it doesn't.

    --
    http://fruiture.de
      It doesn't quite have the same flexibility as perl's anonymous subs but there is an equivalent in PHP
      <?php $f = create_function('$s', 'echo "got: $s";'); $f("a string"); ?> __output__ got: a string
      So we have an anonymous function but unfortunately it is isn't totally orthogonal with normal functions in PHP.
      HTH

      _________
      broquaint

        Aha. Well, although i can only see this as quite ugly (especially compared to Perl), it is in fact an anonymous function. Thanks

        --
        http://fruiture.de
Re: (jeffa) Re: PHP vs Perl code compare
by Xaositect (Friar) on Oct 28, 2002 at 19:16 UTC
    I have no problems with PHP as a language, I learned it before I learned Perl, and it has its own strengths. (Readability, designed for web apps) However, when it comes to making use of existing code modules, nothing I've seen can touch CPAN. Frankly CPAN has spoiled me considerably, I find locating PHP modules to be an extremely irritating task now.

    Speaking of which, I spent quite a bit of time a few weeks ago looking for a good template module for PHP, and was finally delighted to find vLib Templates. I'm not sure how its caching speedup compares to Smarty's, but it had the impressive bonus of looking very familiar.