1

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("\n", $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

NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143
  • Take a look [here](http://stackoverflow.com/questions/9097682/obtain-first-line-of-a-string-in-php) – ex3v Jul 16 '14 at 07:42
  • 1
    Wow, I searched for this for few hours and you got it in a second.. I need to work on my searching skills. Thank you VERY much :) – user2961021 Jul 16 '14 at 07:44

0 Answers0