in reply to Re: Re: variable set to 0 ? 0 : 1
in thread variable set to 0 ? 0 : 1
If that's too idiomatic, using return asbool($status) where that's an inlined function would be readable and just as efficient.
Note that it does a bit more than it does in a stronly-typed language. What if $status is not an int at all? The normal boolism is to treat undef and empty strings as false, also, and in one known case 0e1 is used as zero-but-true. The original test will be different from that; the !! idiom preserves it.
—John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: variable set to 0 ? 0 : 1
by BrowserUk (Patriarch) on Sep 06, 2002 at 19:17 UTC |