src/ArrayLib.php
public static function indexDiff(array $array1, array $array2)
    {
        $indexes = array();
        $flippedArray2 = array_flip($array2); # swaps indexes and values
       
        foreach ($array1 as $index => $value)
        {
            if (!isset($flippedArray2[$value])) 
            {
                $indexes[] = $index;
            }
        }
        
        return $indexes;
    }
public static function indexDiff(array $array1, array $array2)
    {
        $indexes = array();
        $flippedArray2 = array_flip($array2); # swaps indexes and values
       
        foreach ($array1 as $index => $value)
        {
            if (!isset($flippedArray2[$value])) 
            {
                $indexes[] = $index;
            }
        }
        
        return $indexes;
    }
public static function indexDiff ( array $ array1 , array $ array2 ) { $ indexes = array ( ) ; $ flippedArray2 = array_flip ( $ array2 ) ; # swaps indexes and values foreach ( $ array1 as $ index => $ value ) { if ( ! isset ( $ flippedArray2 [ $ value ] ) ) { $ indexes [ ] = $ index ; } } return $ indexes ; }
Same as array_diff except that this returns the indexes of the values
that are in array1 but not array2.
WARNING - this is NOT comparing the indexes themselves.
@param array $array1
@param array $array2
@return array - array of indexes in array1 where the values are not in
array2
Same as array_diff except that this returns the indexes of the values that are in array1 but not array2 . WARNING - this is NOT comparing the indexes themselves .