Re: Assign multiple variables from mysql_fetch_row() call

From: Date: Wed, 05 Sep 2001 00:11:38 +0000
Subject: Re: Assign multiple variables from mysql_fetch_row() call
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-65967@lists.php.net to get a copy of this message
You wrote: > ($var1, $var2) is magic. I hate magic. It's not magic. It's just simpler. > What do you look up in the Perl > manual when you hit syntax like that? http://www.perldoc.com/perl5.6/pod/perldata.html > In PHP the equivalent syntax is: > > list($var1, $var2) = ... Which is longer, and requires you to learn a keyword that you don't need to learn in Perl. > It does exactly the same thing, and it is legible. Anybody can pop over > to http://php.net/list and get an explanation of what the code > does if > they run across it. I use list context a lot in PHP and Perl, and I prefer Perl's way of doing it *because* it allows you to be as verbose or terse as you like. PHP, unfortunately, doesn't give you that freedom. -- -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/

« previous php.general (#65967) next »