Re: [PHP7][Bug?] What is the difference between 'boolean' and 'bool'?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My bad! I totally missed the gist link.

It definitely looks like PHP is treating "boolean" as a class name rather
than a synonym for the "bool" scalar type. Sticking to "bool" seems to
avoid the problem. Have you run into any cases where using "bool" fails? I
recommend submitting a bug report to either make "boolean" work or remove
it.

It's interesting that they chose to disallow null values for scalar
parameters, unlike classes and arrays. It would be nice to allow null by
using something like this: function bar(bool? $foo) {...}

BTW, I love the quirky yet logical error message "Argument 1 passed to
bar() must be an instance of boolean, boolean given".

David

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux