> Hehe... and to think this whole line of discussion started because
> someone advocates list() over () when the latter, IMO, is better because
> the former is redundant. That's what it comes down to, really. *shrug*
Most syntax is redundant.
($var1, $var2) = foo();
might as well be written a
> Which is why you see spoofs like this one
> http://bbspot.com/News/2001/03/perl_test.html
The Perl code in that spoof isn't even valid. ;)
And besides, the fact that you can write Perl code that looks like that
and still functions is more of a feature than anything. Code that is
written like
> You wrote:
> > >Sure it is. Lists or list context. () is not that hard to
> > determine
> > >what it means. At least, not nearly as hard as you make it out to
> > >be for any moderately-experienced programmer.
> >
> > So it's easy to look it up is if you already know what it does? I
> > think
On Wed, 5 Sep 2001 17:13:59 -0400, Ryan Fischer ([EMAIL PROTECTED])
wrote:
>You wrote:
>> >Sure it is. Lists or list context. () is not that hard to
>> determine
>> >what it means. At least, not nearly as hard as you make it out
to
>> >be for any moderately-experienced programmer.
>>
>> So it's
You wrote:
> >Sure it is. Lists or list context. () is not that hard to
> determine
> >what it means. At least, not nearly as hard as you make it out to
> >be for any moderately-experienced programmer.
>
> So it's easy to look it up is if you already know what it does? I
> think the majority of
On Wed, 5 Sep 2001 14:36:59 -0400, Ryan Fischer ([EMAIL PROTECTED])
wrote:
>> > 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.perl
- Original Message -
From: "Ryan Fischer" <[EMAIL PROTECTED]>
To: "Mark Maggelet" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, September 05, 2001 1:35 PM
Subject: Re: [PHP] Assign multiple variables from mysql_fetch_row() call
> Yo
> > 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
>
> I said "what" not "where". I still maintain t
You wrote:
> >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.
>
> Hmm... the freedom to write unreadable, unmaintainable code, yes this
> is a ve
On Tue, 4 Sep 2001 14:29:42 -0700 (PDT), Rasmus Lerdorf
<[EMAIL PROTECTED]> wrote:
>> In perl I can say something like:
>>
>>($var1, $var2) = $sqh->fetchrow_array()
>($var1, $var2) is magic. I hate magic. What do you look up in the Perl
>manual when you hit syntax like that? In PHP the eq
On Wed, 5 Sep 2001 06:59, Rasmus Lerdorf wrote:
> > In perl I can say something like:
> >
> >($var1, $var2) = $sqh->fetchrow_array()
> >
> >
> > to assign column values to more than one variable at a time. So I
> > tried similar syntax with PHP:
> >
> >
> > ($var1, $var2) = mysql_fetch_r
>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.
Hmm... the freedom to write unreadable, unmaintainable code, yes this
is a very important feature.
> 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
I said "what" not "where". I still maintain that if you don't know
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,
You can use a while loop. Ie: (where $row is the result of a sql query)
if ($row = mysql_fetch_array($result)) {
do {
$var1 = $row["column1"];
$var2 = $row["column2"];
$var2 = $row["column3"];
} while ($row = mysql_fetch_array($resu
> In perl I can say something like:
>
>($var1, $var2) = $sqh->fetchrow_array()
>
>
> to assign column values to more than one variable at a time. So I
> tried similar syntax with PHP:
>
>
> ($var1, $var2) = mysql_fetch_row($sqh);
>
>
> but could not seem to work it out.
>
> I know you can
16 matches
Mail list logo