如何在PHP中获取字符串的第一部分?

我在PHP中有以下字符串:

App\Classes\Frontend\Builder

我已经掌握了我班上的最后一句话:

$class_name = 'App\Classes\Frontend\Builder';
$pos        = strrpos( $class_name, '\\' );
$class      = strtolower( substr( $class_name, $pos + 1 ) ); //Returns Builder

But how can I get now everything before App\Classes\Frontend without the last \?

评论