<?php
$sentence = "This is a sentence that has lots
of
line breaks
in it
for no apparent
reason!!!";
$numberoflinebreaks = substr_count($sentence,"\n");
echo "There are $numberoflinebreaks line breaks in that sentence";
?>There are 9 line breaks in that sentence