<?php

function shake($string){
    if(empty(
$string) === false)
    {
        
$rand rand(0,strlen($string));
        
$char $string{$rand};
        
$string substr($string,0,$rand).substr($string,$rand+1);
        return 
$char.shake($string);
    }else
    {
        return 
null;
    }
}

function 
drug($string){
    
$out '';
    
$words explode(' ',$string);
    foreach(
$words as $word){
        
$out .= substr($word,0,1).shake(substr($word,1,-1)).substr($word,-1,1).' ';
    }
    return 
$out;
}


echo(
$_GET['text'].'<br />');
echo(
drug($_GET['text']));


?>