note 110829 deleted from language.operators.logical by cmb

From: Date: Tue, 16 Oct 2018 18:15:28 +0000
Subject: note 110829 deleted from language.operators.logical by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209456@lists.php.net to get a copy of this message
Note Submitter: dartello at gmail dot com ---- Unlike in C/C++ the invertor (Not) in PHP assumes a string: <?php $a = 1; $t = !$a; var_dump($t); ?> The above example will output: string(0) => "" To approach the C/C++ handling, this can be solved as follows: <?php $a = 1; (int) $t = !$a; var_dump($t); (bool) $u = !a; var_dump($u); ?> The above example will output: int(0) bool(false)

« previous php.notes (#209456) next »