original_string: public function update($table, array $data, array $conditions, $filter = true)
      {
          if ($filter) {
              $data = $this->filterValues($table, $data);
          }
  
          if (empty($data)) {
              return 0;
          }
  
          $farray = array();
          foreach (array_keys($data) as $key) {
              $farray[] = "$key=:$key";
          }
  
          $carray = array();
          foreach (array_keys($conditions) as $key) {
              $carray[] = "$key=:$key";
          }
  
          $fields = implode(',', $farray);
          $sql = "UPDATE $table SET $fields WHERE " . implode(' AND ', $carray);
  
          $stmt = $this->pdo->prepare($sql);
  
          foreach ($data as $key => $value) {
              $stmt->bindValue(":$key", $value);
          }
  
          foreach ($conditions as $key => $value) {
              $stmt->bindValue(":$key", $value);
          }
  
          $stmt->execute();
          $this->executed[] = $sql;
          return $stmt->rowCount();
      }
code: public function update($table, array $data, array $conditions, $filter = true)
      {
          if ($filter) {
              $data = $this->filterValues($table, $data);
          }
  
          if (empty($data)) {
              return 0;
          }
  
          $farray = array();
          foreach (array_keys($data) as $key) {
              $farray[] = "$key=:$key";
          }
  
          $carray = array();
          foreach (array_keys($conditions) as $key) {
              $carray[] = "$key=:$key";
          }
  
          $fields = implode(',', $farray);
          $sql = "UPDATE $table SET $fields WHERE " . implode(' AND ', $carray);
  
          $stmt = $this->pdo->prepare($sql);
  
          foreach ($data as $key => $value) {
              $stmt->bindValue(":$key", $value);
          }
  
          foreach ($conditions as $key => $value) {
              $stmt->bindValue(":$key", $value);
          }
  
          $stmt->execute();
          $this->executed[] = $sql;
          return $stmt->rowCount();
      }
code_tokens: public function update ( $ table , array $ data , array $ conditions , $ filter = true ) { if ( $ filter ) { $ data = $ this -> filterValues ( $ table , $ data ) ; } if ( empty ( $ data ) ) { return 0 ; } $ farray = array ( ) ; foreach ( array_keys ( $ data ) as $ key ) { $ farray [ ] = "$key=:$key" ; } $ carray = array ( ) ; foreach ( array_keys ( $ conditions ) as $ key ) { $ carray [ ] = "$key=:$key" ; } $ fields = implode ( ',' , $ farray ) ; $ sql = "UPDATE $table SET $fields WHERE " . implode ( ' AND ' , $ carray ) ; $ stmt = $ this -> pdo -> prepare ( $ sql ) ; foreach ( $ data as $ key => $ value ) { $ stmt -> bindValue ( ":$key" , $ value ) ; } foreach ( $ conditions as $ key => $ value ) { $ stmt -> bindValue ( ":$key" , $ value ) ; } $ stmt -> execute ( ) ; $ this -> executed [ ] = $ sql ; return $ stmt -> rowCount ( ) ; }
docstring: Performs a UPDATE query
  @param $table
  @param array $data
  @param array $conditions
  @param bool $filter
  @return integer
docstring_tokens: Performs a UPDATE query