[LUNI] How do you in php???

ed-luni at inkdroid.org ed-luni at inkdroid.org
Sat Apr 24 20:08:24 CDT 2004


On Sat, Apr 24, 2004 at 04:45:36PM -0500, Joel F. Hacker wrote:
> $input = sprintf("%.2f", $input);

Actually, it's the same in PHP:

    $input = sprintf("%.2f", $input );

> my @in = @_;
> my @sorted = sort { ${$a}[1] cmp ${$b}[1] or ${$a}[2] cmp ${$b}[2] or 
> ${$a}[3] cmp ${$b}[3] } @in;

Try using array_multisort(). 

    array_multisort( $in );

While it's always good to expand you knowledge and learn new languages I
have to say as someone who has had to program in PHP and Perl for
several years that moving from Perl ==> PHP is the exact opposite of
what I would recommend. A few reasons for this are: you don't have
to recompile the language just to extend it in a particular way; you've
got the wealth of CPAN at your fingertips, and you've got a language
that has had a lot of thought put into it, versus one that has expanded
in an almost adhoc fashion. But I've been dabbling in Python lately so go
figure :)

If you have any more questions about Perl and PHP I'd be glad to
help. About a year ago I wrote a brief article [1] describing the
differences and similarities in what I consider to be an objective
fashion...something that I find harder these days.

//Ed

[1] "Paying Homage to Perl (PHP)", The Perl Review, http://www.theperlreview.com/Articles/v0i7/php.pdf



More information about the luni mailing list