I posted this to the Manual notes the other day, but I thought I'd repost it
here for discussion. :)


It seems there is no way to access the return value of a method (or any
function) inline, without assigning it to a variable.

For example:

class Test
{ 
    function blah () 
    { 
        return array(1,2,3); 
    } 

    function childTest () 
    { 
        return new Test; 
    } 
} 

$test = new Test; 

// This does not work: 
$foo = $test->blah()[0]; 

// Instead have to do: 
$temp = $test->blah(); 
$foo = $temp[0]; 

// Similarly for objects, cannot do: 
$foo = $test->childTest()->blah(); 

// Instead have to do: 
$temp = $test->childTest(); 
$foo = $temp->blah(); 


:-(



Regards

Simon Garner



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to