"turnitup" <same@samewrote in message
news:47***********************@news.zen.co.uk...
What is the easiest way of testing whether a call to __set() has been
successful?
At the moment doing
$success = ($foo->bar = "fred");
echo $success
returns "fred", even though the __set function returns TRUE.
Any thoughts?
whatever happens to or during $foo->bar being set, you are doing a double
assignment...two variables being given the same assignment. 'fred' is NOT
being piped to $success through $foo. further, if bar is a *defined*
interface of $foo, __set() will NEVER be called. __set() is meant to handle
*undefined* interfaces the caller is trying to use...a good place to say,
'invalid property accessed'.