Re: Multiple words str_shuffle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jochem Maas schreef:

</snip>

this is a little better:

<?php

// $argv[1] is the first script argument on the CLI
$phrase = isset($argv[1]) && is_string($argv[1]) ? $argv[1] : 'The rain. in Spain falls, mainly "on" the plain!';
$phrase = preg_replace_callback('#(\w+)#', 'mixit', str_replace(" ", "  ", $phrase));

function mixit($m)
{
    return trim(chunk_split(str_shuffle(strtoupper($m[1])),1,' '));
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux