简体   繁体   中英

PHP code type transformation understanding

Hello I'm start learning php, please help me understand code

$a = True.False;
echo $a;

Result -> 1

But!


$b = True.True;
echo $b;

Result - > 11

why is this happening?

A boolean TRUE value is converted to the string "1". Boolean FALSE is converted to "" (the empty string). This allows conversion back and forth between boolean and string values.

From the manual: https://www.php.net/manual/en/language.types.string.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM