src/Corpus/TextCorpus.php
/**
     * Return all the position of the needle found in the text
     * @param string $needle
     * @return array
     */
Return all the position of the needle found in the text
@param string $needle
@return array
Return all the position of the needle found in the text @param string $needle @return array
public function findAll(string $needle) : array
    {
        $lastPos = 0;
        $positions = [];
        $needle = strtolower($needle);
        $text = strtolower($this->getText());
        $needleLength = strlen($needle);
        while (($lastPos = stripos($text, $needle, $lastPos))!== false)
        {
            $positions[] = $lastPos;
            $lastPos += $needleLength;
        }
        return $positions;
    }
public function findAll ( string $ needle ) : array { $ lastPos = 0 ; $ positions = [ ] ; $ needle = strtolower ( $ needle ) ; $ text = strtolower ( $ this -> getText ( ) ) ; $ needleLength = strlen ( $ needle ) ; while ( ( $ lastPos = stripos ( $ text , $ needle , $ lastPos ) ) !== false ) { $ positions [ ] = $ lastPos ; $ lastPos += $ needleLength ; } return $ positions ; }
Return all the position of the needle found in the text
 @param string $needle
 @return array
Return all the position of the needle found in the text @param string $needle @return array