Puoi fare anche così

$t=file($testo);
$numero_a_capo=count($t);