PHP: Compter le nombre de paragraphe d’un fichier

Author:
 
<?php
$paragraphs = 0;
 
if ($fh = fopen('test.txt','r')) {
  while (! feof($fh)) {
    $s = fgets($fh);
    if ((" " == $s) || (" " == $s)) {
      $paragraphs++;
    }
  }
}
print $paragraphs;
?>
  
  

Leave a Reply

Your email address will not be published. Required fields are marked *


one × = 7