CI 4 find return value

PHP
$this->db
  ->where(['field'=>'foo'])
  ->from("tablename")
  ->count_all_results();

//OR 
$this->db
  ->where(['field'=>'foo'])
  ->count_all_results("tablename");
Source

Also in PHP: