On 8/9/06, Peter Beckman <[EMAIL PROTECTED]> wrote:

I want to access a variable within a function-returned array without
setting the array to a variable first.  Example -- test for equal to
'foo' on the 4th element of a returned fetch row:

     if (($row = mysql_fetch_row($result))[3] == 'foo') {
         $user = $row;


     $bar = explode('#', $str)[2];

i don't think it is possible to do such syntax. nor theres a work around on
to make it way you want it. (i'm not an expert. just IMHO)

I know I can do this in perl, but can it be done in PHP?  Obviously this is
pseudo code, it doesn't actually work, but I wonder if there is a way that
escapes me currently?

I know I can assign the result to a variable and then test the element; I
am addicted to trying to cut down the amount and complexity of code.  Even

if you disagree with my goal as good computing practices,

i agree, its not a good programming practice and its makes your code less
readable. :)

I simply want to
know if what I ask is possible, and if so, how. :-)


Peter Beckman                                                  Internet

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

GMail Rocks!!!

GMail Rocks!!!

Reply via email to