in reply to (jeffa) Re: PHP vs Perl code compare
in thread PHP vs Perl code compare

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

--
http://fruiture.de
  • Comment on Re: (jeffa) Re: PHP vs Perl code compare

Replies are listed 'Best First'.
Re: Re: (jeffa) Re: PHP vs Perl code compare
by broquaint (Abbot) on Oct 28, 2002 at 12:13 UTC
    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