Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8780

Re: question about class getters

From Christoph Becker <cmbecker69@gmx.de>
Newsgroups comp.lang.php
Subject Re: question about class getters
Date 2013-03-21 14:12 +0100
Organization Aioe.org NNTP Server
Message-ID <kif0v6$m43$1@speranza.aioe.org> (permalink)
References (1 earlier) <khvkl7$c5m$1@dont-email.me> <d4b5e6d8-c4c5-4aca-a857-71404fe8df5c@7g2000yqy.googlegroups.com> <khvqpp$h7g$1@dont-email.me> <kiek0l$vq1$1@dont-email.me> <kievso$9hu$1@dont-email.me>

Show all headers | View raw


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

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

question about class getters David Heller <daveh@allheller.net> - 2013-03-15 08:42 -0700
  Re: question about class getters Salvatore <sal@yojimbo.hack.invalid> - 2013-03-15 16:12 +0000
    Re: question about class getters David Heller <daveh@allheller.net> - 2013-03-15 09:48 -0700
      Re: question about class getters "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-03-16 12:06 +0100
  Re: question about class getters Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-15 13:11 -0400
    Re: question about class getters David Heller <daveh@allheller.net> - 2013-03-15 10:53 -0700
      Re: question about class getters Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-15 14:56 -0400
        Re: question about class getters Curtis Dyer <dyer85@gmail.com> - 2013-03-21 09:31 +0000
          Re: question about class getters Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-21 08:55 -0400
            Re: question about class getters Christoph Becker <cmbecker69@gmx.de> - 2013-03-21 14:12 +0100
            Re: question about class getters Curtis Dyer <dyer85@gmail.com> - 2013-03-23 07:14 +0000
              Re: question about class getters Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-23 08:46 -0400

csiph-web