Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find the last occurrence of a character in a string
<?php strrchr(string $haystack, string $needle, bool $before_needle = false): string|false
<?php     private function dataForSometimesIteration(string $attribute, $removeLastSegmentOfAttribute)

    {

        $lastSegmentOfAttribute = strrchr($attribute, '.');



        $attribute = $lastSegmentOfAttribute && $removeLastSegmentOfAttribute

                    ? Str::replaceLast($lastSegmentOfAttribute, '', $attribute)