http://www.php.net/manual/en/function.substr-count.php

echo substr_count($text, '
');

ciao