Jump to content

majuk

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by majuk

  1. In the lesson on PHP Filters in the code sample "Validate an Integer" there is the following code:

    <?php
    $int = 100;
    
    if (!filter_var($int, FILTER_VALIDATE_INT) === false) {
        echo("Integer is valid");
    } else {
        echo("Integer is not valid");
    }
    ?> 

    Why use this expression:

    (!filter_var($int, FILTER_VALIDATE_INT) === false)

    instead of what seems to me to be the more logical expression?:

      (filter_var($int, FILTER_VALIDATE_INT) === true)

    Thanks.

×
×
  • Create New...