public function step4()
    {
        //    ement  ance   ence  able ible   ant  ment   ent   ism   ate   iti   ous   ive   ize al  er   ic
        //      delete
        if ( ($position = $this->search(array(
            'ance', 'ence', 'ement', 'able', 'ible', 'ant', 'ment', 'ent', 'ism',
            'ate', 'iti', 'ous', 'ive', 'ize', 'al', 'er', 'ic'))) !== false) {

            if ($this->inR2($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }
            return true;
        }

        // ion
        //      delete if preceded by s or t
        if ( ($position = $this->searchIfInR2(array('ion'))) !== false) {
            $before = $position - 1;
            $letter = Utf8::substr($this->word, $before, 1);

            if ($letter == 's' || $letter == 't') {
                $this->word = Utf8::substr($this->word, 0, $position);
            }

            return true;
        }

        return false;
    }
public function step4()
    {
        //    ement  ance   ence  able ible   ant  ment   ent   ism   ate   iti   ous   ive   ize al  er   ic
        //      delete
        if ( ($position = $this->search(array(
            'ance', 'ence', 'ement', 'able', 'ible', 'ant', 'ment', 'ent', 'ism',
            'ate', 'iti', 'ous', 'ive', 'ize', 'al', 'er', 'ic'))) !== false) {

            if ($this->inR2($position)) {
                $this->word = Utf8::substr($this->word, 0, $position);
            }
            return true;
        }

        // ion
        //      delete if preceded by s or t
        if ( ($position = $this->searchIfInR2(array('ion'))) !== false) {
            $before = $position - 1;
            $letter = Utf8::substr($this->word, $before, 1);

            if ($letter == 's' || $letter == 't') {
                $this->word = Utf8::substr($this->word, 0, $position);
            }

            return true;
        }

        return false;
    }
public function step4 ( ) { //    ement  ance   ence  able ible   ant  ment   ent   ism   ate   iti   ous   ive   ize al  er   ic //      delete if ( ( $ position = $ this -> search ( array ( 'ance' , 'ence' , 'ement' , 'able' , 'ible' , 'ant' , 'ment' , 'ent' , 'ism' , 'ate' , 'iti' , 'ous' , 'ive' , 'ize' , 'al' , 'er' , 'ic' ) ) ) !== false ) { if ( $ this -> inR2 ( $ position ) ) { $ this -> word = Utf8 :: substr ( $ this -> word , 0 , $ position ) ; } return true ; } // ion //      delete if preceded by s or t if ( ( $ position = $ this -> searchIfInR2 ( array ( 'ion' ) ) ) !== false ) { $ before = $ position - 1 ; $ letter = Utf8 :: substr ( $ this -> word , $ before , 1 ) ; if ( $ letter == 's' || $ letter == 't' ) { $ this -> word = Utf8 :: substr ( $ this -> word , 0 , $ position ) ; } return true ; } return false ; }
Step 4
Search for the longest among the following suffixes, and, if found and in R2, perform the action indicated.
Step 4 Search for the longest among the following suffixes and if found and in R2 perform the action indicated .