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 ?

Upvotes: 0

Views: 32

Answers (1)

k_turek
k_turek

Reputation: 341

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

Upvotes: 1

Related Questions