public function where($field, $key, $val)
    {
        $db = $this->load();
        $result = [];
        $values = [];
        if ($field === []) {
            foreach ($db as $index => $row) {
                if ($row[$key] === $val) {
                    foreach (array_keys($row) as $c) {
                        $values[$c] = $row[$c];
                    }
                    $result[$index] = $values;
                    $values = [];
                }
            }
        } else {
            foreach ($db as $index => $row) {
                if ($row[$key] === $val) {
                    foreach ((array) $field as $c) {
                        $values[$c] = $row[$c];
                    }
                    $result[$index] = $values;
                    $values = [];
                }
            }
        }
        return $result;
    }
public function where($field, $key, $val)
    {
        $db = $this->load();
        $result = [];
        $values = [];
        if ($field === []) {
            foreach ($db as $index => $row) {
                if ($row[$key] === $val) {
                    foreach (array_keys($row) as $c) {
                        $values[$c] = $row[$c];
                    }
                    $result[$index] = $values;
                    $values = [];
                }
            }
        } else {
            foreach ($db as $index => $row) {
                if ($row[$key] === $val) {
                    foreach ((array) $field as $c) {
                        $values[$c] = $row[$c];
                    }
                    $result[$index] = $values;
                    $values = [];
                }
            }
        }
        return $result;
    }
public function where ( $ field , $ key , $ val ) { $ db = $ this -> load ( ) ; $ result = [ ] ; $ values = [ ] ; if ( $ field === [ ] ) { foreach ( $ db as $ index => $ row ) { if ( $ row [ $ key ] === $ val ) { foreach ( array_keys ( $ row ) as $ c ) { $ values [ $ c ] = $ row [ $ c ] ; } $ result [ $ index ] = $ values ; $ values = [ ] ; } } } else { foreach ( $ db as $ index => $ row ) { if ( $ row [ $ key ] === $ val ) { foreach ( ( array ) $ field as $ c ) { $ values [ $ c ] = $ row [ $ c ] ; } $ result [ $ index ] = $ values ; $ values = [ ] ; } } } return $ result ; }
Gets an array of field names against values for every row in the data set where a field has a given value.

@param array $field  the names of the fields to return
@param string $key   the key of the field to check
@param string $val   the value to check the field for
@return array        the returned fields
Gets an array of field names against values for every row in the data set where a field has a given value .