note 11380 modified in Classes and Objects by jmcastagnetto

From: Date: Thu, 01 Mar 2001 23:07:56 +0000
Subject: note 11380 modified in Classes and Objects by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-11749@lists.php.net to get a copy of this message
[Editor's note: Remember tha PHP is not a hard core OOP language, and even the ones that are do not always support the unusual vector/array references applied to results from methods.] 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(); :-( http://www.php.net/manual/classes-and-objects.php

« previous php.notes (#11749) next »