PHP code example of lukaszmakuch / array-utils-comparator

1. Go to this page and download the library: Download lukaszmakuch/array-utils-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/ */

    

lukaszmakuch / array-utils-comparator example snippets

 php
ArrayComparator::arraysHoldEqualElements([1, 2, 3], [1, 2, 3]); //true
ArrayComparator::arraysHoldEqualElements([1, 2, 3], [1, 2, 3, 4]); //false
ArrayComparator::arraysHoldEqualElements([1, 2, 3], [1, 3, 2]); //true
 php
ArrayComparator::arraysHoldEqualElements(
    [1, 2, 3],
    [2, 4, 6],
    function ($arr1Elem, $arr2Elem) {
		return ((2 * $arr1Elem) === $arr2Elem);
    }  
); //true