On Apr 29, 2007, at 9:26 AM, Jakob Buchgraber wrote:
I'd like to cast a string "false" to a boolean.
So is there a way to cast such a string to a boolean (without using
conditions)?
The string "false" will evaluate to true, any way you slice it. The
only strings that evaluate to false are "" and "0".
http://www.php.net/manual/en/language.types.boolean.php
I suppose you could eval the string... But you should think hard
before doing this. I can't image a justification for it. If you're
getting input for a false value as "false" you should really use some
kind of conditional statement.
-- Dell
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php