Re: Function boolval()
Hi
2012/4/27 Jille Timmermans <[email protected]>:
> Hi,
>
> I suggest we add a function boolval(). It simply converts the given argument
> to a boolean, like strval(), intval() and floatval(). I already have an
> implementation ready[1].
>
> Why?
> * It is missing in the current list of *val()-functions and people expect it
> to exist. I'd say it is an inconsistency.
> * It can be used as a callback, which is why a bool-cast does not suffice.
Does it really matter nowadays when we got closures anyway:
$bools = array_map(range('a', 'z'), function($a){ return((boolean) $a); });
--
regards,
Kalle Sommer Nielsen
[email protected]
Thread (8 messages)