title: How can I get the first part of a string in PHP?
body: <p>I've this string in PHP:</p>
  
  <pre><code>App\Classes\Frontend\Builder
  </code></pre>
  
  <p>I'm already getting the last word which is my class:</p>
  
  <pre><code>$class_name = 'App\Classes\Frontend\Builder';
  $pos        = strrpos( $class_name, '\\' );
  $class      = strtolower( substr( $class_name, $pos + 1 ) ); //Returns Builder
  </code></pre>
  
  <p>But how can I get now everything before <code>App\Classes\Frontend</code> without the last <code>\</code>?</p>