Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #8807
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: question about class getters |
| Date | 2013-03-23 08:46 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <kik834$cud$1@dont-email.me> (permalink) |
| References | (2 earlier) <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> <kijkpc$g83$1@dont-email.me> |
On 3/23/2013 3:14 AM, Curtis Dyer wrote:
> Jerry Stuckle <jstucklex@attglobal.net> wrote:
>
>> On 3/21/2013 5:31 AM, Curtis Dyer wrote:
>>> Jerry Stuckle <jstucklex@attglobal.net> wrote:
>>>
>>>> On 3/15/2013 1:53 PM, David Heller wrote:
>>>>> On Mar 15, 1:11 pm, Jerry Stuckle <jstuck...@attglobal.net>
>>>>> wrote:
>>>>>> On 3/15/2013 11:42 AM, David Heller wrote:
>
> <snip>
>
>>>>> public function __construct() { // Constructor
>>>>> $this->my_array = array('Mon', 'Tues', 'Wed',
>>>>> 'Thurs', 'Friday',
>>>>> 'Sat', 'Sun');
>>>
>>> Just out of curiosity, why is `Friday' the only day of the week
>>> that's not abbreviated in your list?
>>
>> It's not my list.
>
> Right, but this portion of my response was to the OP. If I botched
> my quoting, my apologies.
>
> <snip>
>
>>> Yes, the `__get()' magic method expects a string, and moreover,
>>> if the OP intends to use the class similarly to the code they
>>> posted initially, it would be a syntax error:
>>>
>>> echo $obj->2; /* parse error */
>>>
>>> Using a custom getter method as you posted above, IMO, seems
>>> easiest.
>>
>> echo $obj->'2'; should work (although I haven't tried it).
>
> That's still a syntax error; I tested in 5.4.12. However, I haven't
> bothered to check if it works in prior versions.
>
As I said - it was untested.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll 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