public function first($cb=null)
    {
        if ($cb==null) {
            return $this->isNotEmpty()?$this->rows[0]:null;
        } else {
            // method returns the first element in the collection that passes 
            //a given truth test
            foreach ($this->rows as $index=>$row) {
                if ($cb($row, $index)===true) {
                    return $row;
                }
            }
        }
        return null;
    }
public function first($cb=null)
    {
        if ($cb==null) {
            return $this->isNotEmpty()?$this->rows[0]:null;
        } else {
            // method returns the first element in the collection that passes 
            //a given truth test
            foreach ($this->rows as $index=>$row) {
                if ($cb($row, $index)===true) {
                    return $row;
                }
            }
        }
        return null;
    }
public function first ( $ cb = null ) { if ( $ cb == null ) { return $ this -> isNotEmpty ( ) ? $ this -> rows [ 0 ] : null ; } else { // method returns the first element in the collection that passes  //a given truth test foreach ( $ this -> rows as $ index => $ row ) { if ( $ cb ( $ row , $ index ) === true ) { return $ row ; } } } return null ; }
Return a first row meet a condition defined by callback function

$row = $store->first(fucntion($row){
return $row["age"]>20;
});

@param function $cb Callback function that return true if a row meets condition

@return array The first row that meets condition.
Return a first row meet a condition defined by callback function