public static function arraysContainOnlyValue(array $containers, $value, $exceptNContainers = 0, array $exceptAtIndex = [], array &$invalidContainers = [], array &$validContainers = [])
    {
        if ($exceptNContainers < 0) {
            $exceptNContainers = 0;
        } else {
            $exceptNContainers = intval($exceptNContainers);
        }
        
        $validCount = 0;
        $rowCount = 0;
        
        $expectedValidCount = count($containers) - intval($exceptNContainers);
        
        foreach ($containers as $row) {
            
            if (!is_array($row)) {
                return false;
            }
            
            $valid = true;
            $exceptCount = 0;
            
            for ($i = 0; $i < count($row); $i++) {
                
                if (in_array($i, $exceptAtIndex, true)) {
                    $exceptCount++;
                    continue;
                } else if ($row[$i] !== $value) {
                    $valid = false;
                    break;
                }
            }
            
            if ($exceptCount !== 0 && $exceptCount === count($row)) {
                $valid = false;
            }
            
            if ($valid == true) {
                $validContainers[] = $rowCount;
                $validCount++;
            } else {
                $invalidContainers[] = $rowCount;
            }
            
            $rowCount++;
        }
        
        return $validCount === $expectedValidCount;
    }
public static function arraysContainOnlyValue(array $containers, $value, $exceptNContainers = 0, array $exceptAtIndex = [], array &$invalidContainers = [], array &$validContainers = [])
    {
        if ($exceptNContainers < 0) {
            $exceptNContainers = 0;
        } else {
            $exceptNContainers = intval($exceptNContainers);
        }
        
        $validCount = 0;
        $rowCount = 0;
        
        $expectedValidCount = count($containers) - intval($exceptNContainers);
        
        foreach ($containers as $row) {
            
            if (!is_array($row)) {
                return false;
            }
            
            $valid = true;
            $exceptCount = 0;
            
            for ($i = 0; $i < count($row); $i++) {
                
                if (in_array($i, $exceptAtIndex, true)) {
                    $exceptCount++;
                    continue;
                } else if ($row[$i] !== $value) {
                    $valid = false;
                    break;
                }
            }
            
            if ($exceptCount !== 0 && $exceptCount === count($row)) {
                $valid = false;
            }
            
            if ($valid == true) {
                $validContainers[] = $rowCount;
                $validCount++;
            } else {
                $invalidContainers[] = $rowCount;
            }
            
            $rowCount++;
        }
        
        return $validCount === $expectedValidCount;
    }
public static function arraysContainOnlyValue ( array $ containers , $ value , $ exceptNContainers = 0 , array $ exceptAtIndex = [ ] , array & $ invalidContainers = [ ] , array & $ validContainers = [ ] ) { if ( $ exceptNContainers < 0 ) { $ exceptNContainers = 0 ; } else { $ exceptNContainers = intval ( $ exceptNContainers ) ; } $ validCount = 0 ; $ rowCount = 0 ; $ expectedValidCount = count ( $ containers ) - intval ( $ exceptNContainers ) ; foreach ( $ containers as $ row ) { if ( ! is_array ( $ row ) ) { return false ; } $ valid = true ; $ exceptCount = 0 ; for ( $ i = 0 ; $ i < count ( $ row ) ; $ i ++ ) { if ( in_array ( $ i , $ exceptAtIndex , true ) ) { $ exceptCount ++ ; continue ; } else if ( $ row [ $ i ] !== $ value ) { $ valid = false ; break ; } } if ( $ exceptCount !== 0 && $ exceptCount === count ( $ row ) ) { $ valid = false ; } if ( $ valid == true ) { $ validContainers [ ] = $ rowCount ; $ validCount ++ ; } else { $ invalidContainers [ ] = $ rowCount ; } $ rowCount ++ ; } return $ validCount === $ expectedValidCount ; }
Does a collection of arrays contain only a given value.

Whether or not a given collection of arrays contain only a given $value.

* You can specify that some indexes of contained arrays do not have to match $value by setting the $exceptAtIndex array with the indexes to be ignored.
* When $exceptNContainers > 0, it is allowed that $containers contains $exceptNContainers arrays not matching $value.
* The $invalidContainers parameter is an optional reference that will be filled with the index of arrays from $containers that do not contain the $value value only.
* The $validContainers parameter is an optional reference that will be filled with the index of array from $containers that do contain the $value value only.

@param array $containers
@param mixed $value
@param integer $exceptNContainers
@param array $exceptAtIndex
@param array $invalidContainers
@param array $validContainers
@return boolean
Does a collection of arrays contain only a given value .