/    Sign up×
Community /Pin to ProfileBookmark

getter context

[B]What is a ‘getter context’?[/B]

PHP invokes the __get() method if a property is undefined (or inaccessible) and called in a [B]getter context[/B]. The method accepts one argument, the name of the property. It should return a value which is treated as the value of the property.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogSep 05.2015 — That context just means that it looks like you're calling an object property:
[code=php]
$foo = new Foo();
echo $foo->bar;
[/code]

In that little example, if there is no public property of Foo name "bar", then if Foo has a __get() method, it would be invoked with 'bar' as its argument.
×

Success!

Help @brsastre spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...