Scrambling a word

View: New views
6 Messages — Rating Filter:   Alert me  

Scrambling a word

by Ron Piggott (PHP) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using PHP 4

I am trying to figure out how to scramble a word.  

Example: hello so the output might be elolh

Any ideas?

Ron


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


Re: Scrambling a word

by Michael S. Dunsavage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2008-07-04 at 18:52 -0400, Ron Piggott wrote:

> I am using PHP 4
>
> I am trying to figure out how to scramble a word.  
>
> Example: hello so the output might be elolh
>
> Any ideas?
>
> Ron
>
>

http://koivi.com/letter-scramble/
--
Michael S. Dunsavage


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


Re: Scrambling a word

by Stefano Esposito-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 04 Jul 2008 18:52:49 -0400
Ron Piggott <ron.php@...> wrote:

> I am using PHP 4
>
> I am trying to figure out how to scramble a word.  
>
> Example: hello so the output might be elolh
>
> Any ideas?
>
> Ron
>
>

str_shuffle()
 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 Vieni nei Riccione Family Hotels! Ti aspettano servizi per bambini, ampi spazi per il gioco e tanto divertimento! Prenota subito on-line la tua vacanza!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8058&d=5-7

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


Re: Scrambling a word

by Ron Piggott (PHP) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Is there a way to output the results with a space between each
character?

$shuffled = str_shuffle($str);

On Sat, 2008-07-05 at 01:20 +0200, Stefano Esposito wrote:

> On Fri, 04 Jul 2008 18:52:49 -0400
> Ron Piggott <ron.php@...> wrote:
>
> > I am using PHP 4
> >
> > I am trying to figure out how to scramble a word.  
> >
> > Example: hello so the output might be elolh
> >
> > Any ideas?
> >
> > Ron
> >
> >
>
> str_shuffle()
>  
>
>  --
>  Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>  
>  Sponsor:
>  Vieni nei Riccione Family Hotels! Ti aspettano servizi per bambini, ampi spazi per il gioco e tanto divertimento! Prenota subito on-line la tua vacanza!
>  Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8058&d=5-7


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


Re: Scrambling a word

by Richard Heyes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Is there a way to output the results with a space between each
> character?
>
> $shuffled = str_shuffle($str);

 From memory:

$shuffled = implode(' ', explode('', $shuffled));

--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

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


Parent Message unknown Re: Scrambling a word

by Richard Heyes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Using an empty delimeter with explode leads to a php warning. At least
> in the php versions i worked with. Still there is a similar function:
>
> <?php
> var_dump(chunk_split('test', 1, ' '));

Odd. Don't know where that idea came from then.

--
Richard Heyes

Employ me:
http://www.phpguru.org/cv

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

LightInTheBox - Buy quality products at wholesale price