title: count(): Argument #1 ($var) must be of type Countable|array in php 8
body: <pre><code>public function query($sql, $params = []){
      $this-&gt;_error = false;
      if ($this-&gt;_query = $this-&gt;_pdo-&gt;prepare($sql)) {
          $x = 1;
          if (count($params)) {
              foreach ($params as $param) {
                  $this-&gt;_query-&gt;bindValue($x, $param);
                  $x++;
              }
          }
          if ($this-&gt;_query-&gt;execute()) {
              $this-&gt;_result = $this-&gt;_query-&gt;fetchAll(PDO::FETCH_OBJ);
              $this-&gt;_count = $this-&gt;_query-&gt;rowCount();
              $this-&gt;_lastInsetID = $this-&gt;_pdo-&gt;lastInsertId();
          } else {
              $this-&gt;_error = true;
          }
      }
  </code></pre>
  <p>code working in php 7.2 but not 7.4 &amp; php 8</p>
  <blockquote>
  <p>Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, string given in</p>
  </blockquote>
  <p>when use <strong>is_countable</strong>
  another error</p>
  <blockquote>
  <p>Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;</p>
  </blockquote>
  <p>Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/8.0.2
  Database client version: libmysql - mysqlnd 8.0.2
  PHP extension: mysqli Documentation curl Documentation mbstring Documentation
  PHP version: 8.0.2
  Version information: 5.0.4</p>
  <pre><code>public function query($sql, $params = []){
          $this-&gt;_error = false;
          if($this-&gt;_query=$this-&gt;_pdo-&gt;prepare($sql)){
              $x=1;
              if (count($params)){
                  foreach($params as $param){
                      $this-&gt;_query-&gt;bindValue($x, $param);
                      $x++;
                  }
              }
          
  
              if($this-&gt;_query-&gt;execute()){
                  $this-&gt;_result=$this-&gt;_query-&gt;fetchAll(PDO::FETCH_OBJ);
                  $this-&gt;_count = $this-&gt;_query-&gt;rowCount();
                  $this-&gt;_lastInsetID=$this-&gt;_pdo-&gt;lastInsertId();
              }else {
                  $this-&gt;_error=true;
              }
          }
      return $this;
      }
  
  
  public function insert($table, $fields = []){
      $fieldString='';
      $valueString ='';
      $values =[];
  
      foreach($fields as $field =&gt; $value){
          $fieldString .='`' . $field . '`,';
          $valueString .= '?,';
          $values[] = $value;
      }
      $fieldString = rtrim($fieldString, ',');
      $valueString = rtrim($valueString, ',');
  
      $sql = &quot;INSERT INTO {$table} ({$fieldString}) VALUES ({$valueString})&quot;;
      dnd($sql);
  
      if(!$this-&gt;query($sql, $value)-&gt;error()){
          return true;
          
      }
      return false;
  }
  </code></pre>
  <p>Value where i pass</p>
  <pre><code>public function registerAction(){       
      $db = DB::getInstance();
      $fields = [
          'fname' =&gt; 'Name',
          'lname' =&gt; 'name',
          'email' =&gt; 'email@mail.com'
      ];
      $accountQ = $db-&gt;insert('account', $fields);
  
      
  }
  </code></pre>