random letters order in word (quick help)
Moderator: General Moderators
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
random letters order in word (quick help)
Can't find way to make random letters order in word, for e.g. if string is apple so it should look like ~ "pleap".
Re: random letters order in word (quick help)
did you tryspamyboy wrote:Can't find way to make random letters order in word, for e.g. if string is apple so it should look like ~ "pleap".
Code: Select all
shuffle($string)
Last edited by visitor-Q on Tue Feb 27, 2007 1:52 pm, edited 1 time in total.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
here is what I made:
,kinde of fun text encoding.
Code: Select all
http://php-only.com/spamyboy wrote:here is what I made:,kinde of fun text encoding.Code: Select all
http://php-only.com/
spamyboy wrote: f anyone whould help make it ajax, that would be wounderful.
Um...what does that have to do with randomizing a word? If you need help on another topic, please make a new thread.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
pickle wrote:spamyboy wrote:here is what I made:,kinde of fun text encoding.Code: Select all
http://php-only.com/spamyboy wrote: f anyone whould help make it ajax, that would be wounderful.
Um...what does that have to do with randomizing a word? If you need help on another topic, please make a new thread.

here is exaple of forum output. midle letters are randomized, lol, havent you noticed that
I must admit, I didn't follow your link. I thought the phrase "http://php-only.com" was what you had made, not the webpage hosted there.
A pretty big brain fart on my part
- sorry about that.
A pretty big brain fart on my part
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
it works best when the ascenders and descenders are in the correct places as well
NSG: Those are some niceforms
NSG: Those are some niceforms
- spamyboy
- Forum Contributor
- Posts: 266
- Joined: Sun Nov 06, 2005 11:29 am
- Location: Lithuania, vilnius
How can that be made ?Kieran Huggins wrote:it works best when the ascenders and descenders are in the correct places as well
Code: Select all
<?php
if($_POST['text']) {
$text=$_POST['text'];
$text = explode(" ", $text);
foreach( $text as $word )
{
$word_long=strlen($word)-2;
$first_letter=substr($word, 0, 1);
$random_letters=substr($word, 1, $word_long);
$random_letters=str_shuffle($random_letters);
$last_letter=substr($word, -1, 1);
$word=$first_letter.$random_letters.$last_letter;
$new_words[] = $word;
}
$text = implode(" ", $new_words);
echo $text;
}
?>