title: How to divide text?
body: <p>I have a question. I have a text file that I have installed in PHP, I want to separate 350 words and save them to text files like 1.txt 2.txt 3.txt ... How can I do this?</p>
  
  <p>I tried this but it didn't work:</p>
  
  <pre><code>$text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
   nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
  Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et.";
  
  $word = explode(" ", $text);
  $count = count($word);
  $limit = 40;
  if($count &lt;= $limit) { 
    $cut = $count * 50 / 100; 
  } else { 
    $cut = $limit; 
  }
  for($i = 0; $i &lt;= $cut; $i++) { 
    $text1= $word[$i] . ' '; 
    echo $text1;
  }
  </code></pre>