dimanche 1 novembre 2020

Logical && operator in php

Hello everyone I started to study php but there a few things about logical operators that not convincing me.

<?php
    $a = "hello";
    $b = 3;

    if ($a && $b === 3) {
        echo "true";
    } else {
        echo "false";
    }
?>

Why if I try to check triple equality the if statement print true? $a it's a string and $b a number, and then also if I put in $a a number the result it's the same

Aucun commentaire:

Enregistrer un commentaire