protected function findall(string $haystack, $needle): array
    {
        $lastPos = 0;
        $positions = [];
        while (($lastPos = strpos($haystack, $needle, $lastPos)) !== false) {
            $positions[] = $lastPos;
            $lastPos = $lastPos + 1;
        }
        return $positions;
    }
protected function findall(string $haystack, $needle): array
    {
        $lastPos = 0;
        $positions = [];
        while (($lastPos = strpos($haystack, $needle, $lastPos)) !== false) {
            $positions[] = $lastPos;
            $lastPos = $lastPos + 1;
        }
        return $positions;
    }
protected function findall ( string $ haystack , $ needle ) : array { $ lastPos = 0 ; $ positions = [ ] ; while ( ( $ lastPos = strpos ( $ haystack , $ needle , $ lastPos ) ) !== false ) { $ positions [ ] = $ lastPos ; $ lastPos = $ lastPos + 1 ; } return $ positions ; }
Find all occurrences of a needle in a string

@param string $haystack The string to search in
@param mixed $needle
@return array
Find all occurrences of a needle in a string