[pmwiki-devel] php logic question
Patrick R. Michaud
pmichaud at pobox.com
Wed Mar 14 07:35:49 CDT 2007
On Wed, Mar 14, 2007 at 08:58:44AM +0100, christian.ridderstrom at gmail.com wrote:
> On Tue, 13 Mar 2007, Hans wrote:
> >> if (!$page || !$permit)
>
> Ok. I was wondering if $page was a string, in which case I'm not sure if
> something like
>
> !""
>
> if true or false.
In PHP, the expression !"" evaluates to true.
When treated as a boolean, both the empty string and "0" evaluate to
false, while all other strings are treated as true. Thus !"" is
equivalent to !(false), which results in true.
More information about the treatment of boolean values
in PHP can be found at
http://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting
Pm
More information about the pmwiki-devel
mailing list