0
<?php
    var_dump('00E73694765433'=='0');  //true
    var_dump('0134b40fsbi94u8'=='0'); //false
    var_dump('0134b40fsbi94u8'=='134'); //false
    echo PHP_EOL;
    var_dump(is_numeric('00E73694765433'));//true
    var_dump(is_numeric('0134b40fsbi94u8'));//false
?>

As the code showed,I got into a problem when I compared two strings.I could not understand how the result came even I refered to the official manual. Can anyone help me? Thank you very much!

XjChen
  • 1
  • 1

1 Answers1

2
<?php
    var_dump('00E73694765433'==='0');  //false
    var_dump('0'==='0');  //true
    var_dump('0134b40fsbi94u8'==='0'); //false
    var_dump('0134b40fsbi94u8'==='134'); //false
    var_dump('0134b40fsbi94u8'==='0134b40fsbi94u8'); //true
?>

Use === instead of ==

Komal K.
  • 450
  • 2
  • 13