[nycphp-talk] Casting string "false" to boolean
Jakob Buchgraber
jakob.buchgraber at googlemail.com
Sun Apr 29 09:26:30 EDT 2007
Hey!
I'd like to cast a string "false" to a boolean.
So I tried the following:
<?php
$var = (bool)"false";
var_dump ($var);
?>
Here var_dump gives me:
bool(true)
I also tried using settype:
<?php
$var = "false";
settype ($var, "bool");
var_dump ($var);
?>
The same result here:
bool(true);
So is there a way to cast such a string to a boolean (without using
conditions)?
Cheers,
Jay
More information about the talk
mailing list