PHP code example of scheb / comparator

1. Go to this page and download the library: Download scheb/comparator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

scheb / comparator example snippets


$comparator = new \Scheb\Comparator\Comparator(true); // Type-sensive equal (===)
$comparator->isEqual(0, "0"); // Returns false
$comparator->isEqual(0, ""); // Returns false
$comparator->isEqual(0, 0); // Returns true
$comparator->isEqual(0, "foo"); // Returns false

$comparator = new \Scheb\Comparator\Comparator(false); // Type-insensive equal (==)
$comparator->isEqual(0, "0"); // Returns true
$comparator->isEqual(0, ""); // Returns true
$comparator->isEqual(0, 0); // Returns true
$comparator->isEqual(0, "foo"); // Returns false