public function to($field, $to, $key, $val)
    {
        $db = $this->load();
        foreach ($db as $index => $row) {
            if ($row[$key] === $val) {
                $db[$index][$field] = $to;
            }
        }
        return $this->rewrite($db);
    }
public function to($field, $to, $key, $val)
    {
        $db = $this->load();
        foreach ($db as $index => $row) {
            if ($row[$key] === $val) {
                $db[$index][$field] = $to;
            }
        }
        return $this->rewrite($db);
    }
public function to ( $ field , $ to , $ key , $ val ) { $ db = $ this -> load ( ) ; foreach ( $ db as $ index => $ row ) { if ( $ row [ $ key ] === $ val ) { $ db [ $ index ] [ $ field ] = $ to ; } } return $ this -> rewrite ( $ db ) ; }
Changes the value of a field in rows satisfying a condition.

@param string $field the name of the field to change
@param string $to    the value to change the field to
@param string $key   the name of the field to search for
@param string $val   the value of the field to search for
@return array        the updated data set
Changes the value of a field in rows satisfying a condition .