gventuri / simple-json-db

A simple json db class written in php
10 stars 5 forks source link

Update Function #2

Closed simondotws closed 2 years ago

simondotws commented 2 years ago
  /**
   * UPDATE
   * 
   * @param $data: array
   * @param $key: string
   * 
   * @return DB
   */
  public function update($data, $key){
    if($key !== "")
      $update = array_merge($this->db[$key], $data);
      $this->db[$key] = $update;

    $this->save();

    return $this;
  }
gventuri commented 2 years ago

Hey Simon, thank you so much! Can you create a PR, I'll review and merge asap! 🙌