title: extracting a string up to a string within a long string in php
body: <p>i have searched through the Internet and found a solution to this but it do it in a reverse order.</p>
  
  <p><strong>original string</strong></p>
  
  <pre><code>S0597 KIPATIMU SECONDARY DIV-I = 0  DIV-II = 3  
  </code></pre>
  
  <p><strong>string to be extracted</strong></p>
  
  <pre><code>S0597 KIPATIMU SECONDARY
  
  extraction should stop when "DIV-" is reached.
  </code></pre>
  
  <p><strong>my code output</strong></p>
  
  <pre><code>DIV-I = 0  DIV-II = 3
  </code></pre>
  
  <p><strong>here is my code.</strong></p>
  
  <pre><code>if(($pos = strpos($string, 'DIV-')) !== false)
  {
    $school_name = substr($string, $pos);
  }
  else
  {
     $school_name = get_last_word($string);
  }
  echo $school_name;
  </code></pre>
  
  <p>how can i achieve this?</p>