You are here: __get() not reentrant? « PHP « IT news, forums, messages
__get() not reentrant?

Posted by "Christopher J. Bottaro" on 05/20/05 22:41

Maybe I'm using "reentrant" incorrectly, but here is what I mean...

class Test {
function __get($nm) {
if ($nm == 'x')
return $this->func();
elseif ($nm == 'y')
return 'y';
elseif ($nm == 'xx')
return 'x';
}
function func() {
return $this->xx;
}
}
$t = new Test();
print $t->y . "\n";
print $t->xx . "\n";
print $t->x . "\n";
print $t->func() . "\n";

I would expect the following code to output:
y
x
x
x

But instead, it outputs:
y
x

x

Is this a bug? This limitation is not documented (maybe it should be?).

-- C

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация