As always, in PHP, there are lots of ways to do one thing so here are shown few one line code snippets in order to allow you to select the one that suits you best as well as to determine the fastest method from all shown.

// Average Time 1.1491775512695E-7 for 10000 iterations
substr(strrchr(get_class($foobar), "\\"), 1);
// Average Time 3.0322074890137E-7 for 10000 iterations
(new \ReflectionClass($foobar))->getShortName();
// Average Time 6.6139698028564E-7 for 10000 iterations
basename(str_replace('\\', '/', get_class($foobar)));