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

From: Date: Wed, 16 Dec 2015 20:57:44 +0000
Subject: Re: [PHP7][Bug?] What is the difference between 'boolean' and 'bool'?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-325295@lists.php.net to get a copy of this message
On Wed, 16 Dec 2015 12:51:39 -0800 David Harkness <david.h@highgearmedia.com> wrote: > On Wed, Dec 16, 2015 at 12:46 PM, Daniel Korner < > daniel.korner@tu-dortmund.de> wrote: > > > But that doesn't seem to be the case, as "bool" behaves (in some cases) > > totally > > different than "boolean" (as a type).[2] > > > Can you post some code that demonstrates this? AFAIK they should be > synonyms. > > David Ehh... I tried to avoid posting code via E-Mail (therefor the gist). But Yes I can :) *copy past smallest example from the gist* Code (example4): function bar(boolean $foo): boolean{return $foo;} var_dump(bar((bool)true)); Output: PHP Fatal error: Uncaught TypeError: Argument 1 passed to bar() must be an instance of boolean, boolean given, called in ./example4.php:2 Stack trace: #0 ./example4.php(3): bar(true) #1 {main} thrown in ./example4.php on line 2 Code (example5): function bar(bool $foo): bool{return $foo;} var_dump(bar((boolean)true)); Output: bool(true)

Attachment: [application/pgp-signature] OpenPGP digital signature
« previous php.general (#325295) next »