$rows = 0; $fp = fopen ("archivo.txt","r"); while ($row = $gets($fp)) { $rows += 1; } fclose($fp); echo $rows;