|
Posted by Wayne on 10/20/11 11:31
On 7 Nov 2005 06:34:47 -0800, "ZeldorBlat" <zeldorblat@gmail.com>
wrote:
>No, because makeArray is a function, not a reference or variable. The
>same thing happens when you use __get() and __set(). Although it looks
>like regular property accessing and setting, it really isn't.
Well you're right that you can't do someFunction()[0] but array access
syntax does work for __get and _set. Try this in PHP5 and you'll get
the desired result:
class Test
{
public function __get($name) {
return Array('hello', 'world');
}
public function blah()
{
return Array('hello', 'world');
}
}
$test = new Test();
echo $test->whatever[0];
// displays 'hello'
The original posters problem is entirely different.
Navigation:
[Reply to this message]
|