mercredi 19 mai 2021

How to shuffle words in a given order

I am trying to stop shuffling words. This function takes words random, but I want to make this function to arrange the words in an specific order.

function insert_func($words=0,$min_word_length=0)
{
    $lorem = "this is a simple words list ";
    $words_array = preg_split("#[\n\.\ \,]+#",$lorem);
    mt_srand((double)microtime()*1000000);

    if(strlen($words_array[$i]) >= $min_word_length)
    {
        $output[] = $words_array[$i];
    }
    else
    {
        $words++;
    }
}

$output_str = implode(" ",$output);
$output_str = strtolower($output_str);
$output_str = ucfirst($output_str);

return $output_str;



Aucun commentaire:

Enregistrer un commentaire