Re: [RFC] Scalar Type Hinting With Casts (re-opening)

From: Date: Mon, 14 Jul 2014 13:31:04 +0000
Subject: Re: [RFC] Scalar Type Hinting With Casts (re-opening)
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-75455@lists.php.net to get a copy of this message
On 14/07/14 13:58, Andrea Faulds wrote: > The final option I’m thinking about is a limited set of values. TRUE, FALSE and NULL would be > accepted, along with the integer and float values 1 and 0 (which are the int/float TRUE and FALSE > cast to, respectively), ‘1’ and the empty string (which are the string values TRUE and FALSE > cast to), and ‘0’ (which (string)(int)FALSE would give you), along with objects casting to > boolean. It’s not a perfect solution, but I currently feel that this is the most sensible option > bar going for full strictness. Any valid 'not-0' is true ... Just need to document what are mapped to false ... -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

« previous php.internals (#75455) next »