FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » question about class getters
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: question about class getters [message #180844 is a reply to message #180842] Thu, 21 March 2013 13:12 Go to previous messageGo to previous message
Christoph Becker is currently offline  Christoph Becker
Messages: 91
Registered: June 2012
Karma:
Member
Jerry Stuckle wrote:

> echo $obj->'2'; should work (although I haven't tried it).

That is a syntactic error. FWIW the following works:

PHP 5.4.7 (cli) (???) [WINNT]
>>> class Test {function __get($i) {return $i;}}
>>> $obj = new Test
>>> $obj->{2}
>>> echo $obj->{2}
2

However, I wouldn't use it.

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Will this set or get a SESSION variable?
Next Topic: Fatal error!
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 02:23:11 GMT 2024

Total time taken to generate the page: 0.04834 seconds