On 08/15/2012 11:28 AM, phplist wrote:
This relates to a minor dilemma I come across from time and time, and
I'm looking for advice [...]

Within a site I have a User object, and within page code would like to have
if ($crntUser->isASubscriber) {...}
[...]
if ($crntUser->isASubscriber()) {...}
[...]
Is either of these approaches preferable, or does it simply not matter?


It depends
- how long/heavy is isASubscriber()
- how often you need to check
- how realtime you need the subscription status to be

if isASubscriber() is long/heavy (say you need to wait for a long query), I would suggest to set an attribute and get you information from the attribute.
Otherwise, you can safely use the method.

If you have "realtime" constraints, you have no choice than use the method, wether it's long or not.

Talking about "best practice", I would use:
- $currentUser->isSubscriber
- $currentUser->isSubscriber()
It's a naming matter.



--
RMA.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to