Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Find the last occurrence of a character in a string
strrchr(string $haystackstring $needle): string|false
    private function dataForSometimesIteration(string $attribute$removeLastSegmentOfAttribute)

    {

        
$lastSegmentOfAttribute strrchr($attribute'.');



        
$attribute $lastSegmentOfAttribute && $removeLastSegmentOfAttribute

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