You can use explodeto split the string into a specific character ("\" in this case), and then get the final record.
$string = "App\Models\Wordpress\Wordpress";
$remove="\\";
$pieces = explode($remove, $string);
$last_word = array_pop($pieces);
echo $last_word;
source
share