count rows mysql limit php

PHP
SELECT FOUND_ROWS();SELECT SQL_CALC_FOUND_ROWS id, title FROM foo LIMIT 5;
Source

Also in PHP: