public static function shuffleWords($words)
    {
        $wordParts = explode(' ', trim($words));

        $wordPartsLen = count($wordParts);

        $rand = [];

        do {
            $r = rand(0, $wordPartsLen - 1);

            if (!in_array($r, $rand)) {
                $rand[] = $r;
            }
        } while (count($rand) != $wordPartsLen);

        $sentence = '';

        foreach ($rand as $word) {
            $sentence .= $wordParts[$word] . ' ';
        }

        return trim($sentence);
    }
public static function shuffleWords($words)
    {
        $wordParts = explode(' ', trim($words));

        $wordPartsLen = count($wordParts);

        $rand = [];

        do {
            $r = rand(0, $wordPartsLen - 1);

            if (!in_array($r, $rand)) {
                $rand[] = $r;
            }
        } while (count($rand) != $wordPartsLen);

        $sentence = '';

        foreach ($rand as $word) {
            $sentence .= $wordParts[$word] . ' ';
        }

        return trim($sentence);
    }
public static function shuffleWords ( $ words ) { $ wordParts = explode ( ' ' , trim ( $ words ) ) ; $ wordPartsLen = count ( $ wordParts ) ; $ rand = [ ] ; do { $ r = rand ( 0 , $ wordPartsLen - 1 ) ; if ( ! in_array ( $ r , $ rand ) ) { $ rand [ ] = $ r ; } } while ( count ( $ rand ) != $ wordPartsLen ) ; $ sentence = '' ; foreach ( $ rand as $ word ) { $ sentence .= $ wordParts [ $ word ] . ' ' ; } return trim ( $ sentence ) ; }
Returns a string of words whose words are mixed.

@param string $words

@return string
Returns a string of words whose words are mixed .