PHP-Code:
<?php
$x 
0;
for(
$i=0$i<sizeof($string); $i++){
    if(
substr($string$i1) == "\n"){
        
$x++;
    }
}
?>