protected function biteTongueOnTwitter($phrase)
    {
        if (mb_strlen($this->whisper) <= 140) {
            return $this->whisper;
        }

        /**
         * We need to split by words and start removing characters from middle of word until we
         * get the worst-case length under 140. This will leave the word readable, hopefully.
         *
         * zalgo_len = phrase_len * (1 + 2 + 2)
         * pref_zalgo_len = (phrase_len - some_num_to_remove) * (1 + 2 + 2)
         * 140 = (35 - X) * 5
         * 140 / 5 = 35 - X
         * X = 35 - (140 / 5) = 7
         */

        $phraseLength = mb_strlen($phrase);
        $numberToRemove = (int) ceil(abs($phraseLength - (140 / 3)));
        $removed = 0;

        $words = preg_split('/\s+/', $phrase);

        while ($removed < $numberToRemove) {
            foreach ($words as $index => $word) {
                if (mb_strlen($words[$index]) <= 3) {
                    $removed++;
                    continue;
                }

                // Remove a letter, at random, from the word.
                $words[$index] = substr_replace($words[$index], '', rand(1, mb_strlen($words[$index]) - 2), 1);
                $removed++;

                if ($removed == $numberToRemove) {
                    break;
                }
            }
        }

        return $this->speaks(implode(' ', $words));
    }
protected function biteTongueOnTwitter($phrase)
    {
        if (mb_strlen($this->whisper) <= 140) {
            return $this->whisper;
        }

        /**
         * We need to split by words and start removing characters from middle of word until we
         * get the worst-case length under 140. This will leave the word readable, hopefully.
         *
         * zalgo_len = phrase_len * (1 + 2 + 2)
         * pref_zalgo_len = (phrase_len - some_num_to_remove) * (1 + 2 + 2)
         * 140 = (35 - X) * 5
         * 140 / 5 = 35 - X
         * X = 35 - (140 / 5) = 7
         */

        $phraseLength = mb_strlen($phrase);
        $numberToRemove = (int) ceil(abs($phraseLength - (140 / 3)));
        $removed = 0;

        $words = preg_split('/\s+/', $phrase);

        while ($removed < $numberToRemove) {
            foreach ($words as $index => $word) {
                if (mb_strlen($words[$index]) <= 3) {
                    $removed++;
                    continue;
                }

                // Remove a letter, at random, from the word.
                $words[$index] = substr_replace($words[$index], '', rand(1, mb_strlen($words[$index]) - 2), 1);
                $removed++;

                if ($removed == $numberToRemove) {
                    break;
                }
            }
        }

        return $this->speaks(implode(' ', $words));
    }
protected function biteTongueOnTwitter ( $ phrase ) { if ( mb_strlen ( $ this -> whisper ) <= 140 ) { return $ this -> whisper ; } /**
         * We need to split by words and start removing characters from middle of word until we
         * get the worst-case length under 140. This will leave the word readable, hopefully.
         *
         * zalgo_len = phrase_len * (1 + 2 + 2)
         * pref_zalgo_len = (phrase_len - some_num_to_remove) * (1 + 2 + 2)
         * 140 = (35 - X) * 5
         * 140 / 5 = 35 - X
         * X = 35 - (140 / 5) = 7
         */ $ phraseLength = mb_strlen ( $ phrase ) ; $ numberToRemove = ( int ) ceil ( abs ( $ phraseLength - ( 140 / 3 ) ) ) ; $ removed = 0 ; $ words = preg_split ( '/\s+/' , $ phrase ) ; while ( $ removed < $ numberToRemove ) { foreach ( $ words as $ index => $ word ) { if ( mb_strlen ( $ words [ $ index ] ) <= 3 ) { $ removed ++ ; continue ; } // Remove a letter, at random, from the word. $ words [ $ index ] = substr_replace ( $ words [ $ index ] , '' , rand ( 1 , mb_strlen ( $ words [ $ index ] ) - 2 ) , 1 ) ; $ removed ++ ; if ( $ removed == $ numberToRemove ) { break ; } } } return $ this -> speaks ( implode ( ' ' , $ words ) ) ; }
Hacky implementation detail to clamp Zalgo text to 140 characters
when it is in a mood for Twitter.

@param $phrase

@return string
Hacky implementation detail to clamp Zalgo text to 140 characters when it is in a mood for Twitter .