title: php: truncate text after number of lines is reached?
body: <p>I'm familiar with PHP truncating text based on the maximum number of characters reached, however I am wanting to tweak this from characters to limit text to 10 lines before truncating it.</p>
  
  <p>How could I go about in achieving this?</p>
  
  <p>Here is what I'm using at the moment to limit the number of characters:</p>
  
  <pre><code>&lt;?php $str = $profile['bio'];
  $max = 510;
  if(strlen($str) &gt; $max) {
  $str = substr($str, 0, $max) . '...'; } ?&gt;
  &lt;?php echo $str ?&gt; 
  </code></pre>