如何只打印文章的标题

I would like to ask you whether you have any ideas how to get only the titles of the articles? For example if we have an article:

"I don't know how to program

He doesn't know how to... But he... And so... "

i need to get that "I don't know how to program" part and print it out on screen. Also, this should apply for all titles. I thought of an idea that I should get the line between two empty lines, however at the moment I get only those empty lines and don't know how to print lines that are bellow or above these empty lines. Any ideas? This is what I have at the moment:

 <?php
$getFile = file_get_contents('example.txt'); 
$makeRows = explode("
", $getFile); 
foreach($makeRows as $tmp_row){ 
    if(strlen($tmp_row) <= 1){ 
       for ($start=0; $start < count($tmp_row); $start++){ 
           echo $tmp_row[$start] . "<br />"; 
        }
    }
}
?>  

Thank you for your help in advance