Claro! Abaixo temos o mesmo exemplo usando PDO nas duas formas.
Para este exemplo, usei uma tabela users com 7 registros.
Utilizando SQL_CALC_FOUND_ROWS + FOUND_ROWS()
<?php
$statement = $pdo->prepare('select SQL_CALC_FOUND_ROWS * from users where status = :status limit :limit offset :offset');
$statement->bindValue(':status', 'ACTIVE', PDO::PARAM_STR);
$statement->bindValue(':limit', 3, PDO::PARAM_INT);
$statement->bindValue(':offset', 0, PDO::PARAM_INT);
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
print_r($result);
$statement = $pdo->prepare('select FOUND_ROWS()');
$statement->execute();
$result = $statement->fetch(PDO::FETCH_ASSOC);
print_r($result);
---
Array
(
[0] => Array
(
[id] => 1
[name] => user_a
[status] => ACTIVE
)
[1] => Array
(
[id] => 2
[name] => user_b
[status] => ACTIVE
)
[2] => Array
(
[id] => 3
[name] => user_c
[status] => ACTIVE
)
)
Array
(
[FOUND_ROWS()] => 7
)
Utilizando COUNT(*)
<?php
$statement = $pdo->prepare('select * from users where status = :status limit :limit offset :offset');
$statement->bindValue(':status', 'ACTIVE', PDO::PARAM_STR);
$statement->bindValue(':limit', 3, PDO::PARAM_INT);
$statement->bindValue(':offset', 0, PDO::PARAM_INT);
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
print_r($result);
$statement = $pdo->prepare('select count(*) from users where status = :status');
$statement->execute(['status' => 'ACTIVE']);
$result = $statement->fetch(PDO::FETCH_ASSOC);
print_r($result);
---
Array
(
[0] => Array
(
[id] => 1
[name] => user_a
[status] => ACTIVE
)
[1] => Array
(
[id] => 2
[name] => user_b
[status] => ACTIVE
)
[2] => Array
(
[id] => 3
[name] => user_c
[status] => ACTIVE
)
)
Array
(
[count(*)] => 7
)