Chris W. Parker wrote:
> Jason Barnett <mailto:[EMAIL PROTECTED]>
>     on Friday, February 25, 2005 2:10 PM said:
>
>> $this = $something ? $that : null;
>
> That won't work because I'm setting a default value for $this and want
> it to change only if it has to. The long winded way to write this would
> be:

If you *KNOW* you set the default value:

$this = $something ? $that : $this;

Crude, but effective, Captain   -- Spock

If you're not *SURE* $this has a value:

$this = ($something ? $that : (isset($this) ? $this : NULL));

Some of those parens might be un-needed, but I'd get confused without
them, never mind PHP being confused or not :-)

Course, I gotta say that maybe you're coming at this wrong in the first
place, if you have to change $this based on $something to $that but $this
already has a value...

Maybe you should have figured out what $this should be back when you first
initialized it?

Maybe not.  Can't tell without seeing more code.

-- 
Like Music?
http://l-i-e.com/artists.htm

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

Reply via email to