note 129827 added to language.types.type-juggling
| From: | Anonymous | Date: | Tue, 29 Oct 2024 17:02:13 +0000 |
| Subject: | note 129827 added to language.types.type-juggling | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221620@lists.php.net to get a copy of this message | ||
Type casting in expressions is executed first.
The casting is assigned to the value, not to the expression result.
Examples:
<?php
$string = "777";
var_dump( $string === 777 ); // FALSE
var_dump( (int) $string === 777 ); // TRUE
var_dump( ( (int) $string ) === 777 ); // TRUE
var_dump( (int) ( $string === 777 ) ); // 0
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 176.120.96.134)
----
Manual Page -- https://php.net/manual/en/language.types.type-juggling.php
Edit -- https://main.php.net/note/edit/129827
Del: integrated -- https://main.php.net/note/delete/129827/integrated
Del: useless -- https://main.php.net/note/delete/129827/useless
Del: bad code -- https://main.php.net/note/delete/129827/bad+code
Del: spam -- https://main.php.net/note/delete/129827/spam
Del: non-english -- https://main.php.net/note/delete/129827/non-english
Del: in docs -- https://main.php.net/note/delete/129827/in+docs
Del: other reasons-- https://main.php.net/note/delete/129827
Reject -- https://main.php.net/note/reject/129827
Search -- https://main.php.net/manage/user-notes.php