Board index   FAQ   Search  
Register  Login
Board index PHP Your Scripts

Something Fun :D

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

Something Fun :D

Postby thefiscster510 » Wed Jan 04, 2012 4:38 pm

This is a fun little thing i made.

Code: Select all
<?php $j=chr(rand(97,122));for($i=0;$i<100;$i++){echo"<b>$i</b>:".($i%9?chr(rand(97,122)):$j).($i%10?"":"<br>");} ?>


See an example of what it does here... http://www.fiscalleti.com/mindreader/
thefiscster510
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Jan 04, 2012 4:28 pm

Re: Something Fun :D

Postby egami » Fri Jan 06, 2012 6:29 am

Wondering how this is fun..?
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Something Fun :D

Postby Acorn » Tue Mar 13, 2012 8:13 am

Maybe you should tell us what it is?
Acorn
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Mar 13, 2012 8:07 am

Re: Something Fun :D

Postby LarryMade » Wed Mar 14, 2012 9:48 am

Heh, used to do this stuff in BASIC in high school a lot...

For those who cant read the guys code:
It assigns a random lower case letter to $j
Then for the next 100 steps
it prints the step number in bold,
then if the character is divisible by 9 it prints a different random letter, otherwise it prints $j
If the step number is divisible by 10, it inserts a linebreak. That's it.

I found stuff like this way more fun:

Code: Select all
$parts = array('do','wa','po','ti','ka','ee','ay','ing','pl','a','e','y','ch'
,'sh','qu','nu','re','la','to','i','v','re','i','b','rr','oi','g');
$elements = count($parts);
for($numwords = 0; $numwords <10; $numwords++) {
    $numbits = rand(1,15);
    for($count = 0; $count < $numbits; $count++) {
        echo $parts[rand(0,$elements-1)];
    }
    echo '<br />';
}


there, a random word list generator, add more syllables or change them in the $parts array for more variety, you could also use insult adjetives or something else instead of syllables, for a phrase generator. which would be inspiringly freakin mighty mighty freakin completely sublime utterly cool. :D
LarryMade
New php-forum User
New php-forum User
 
Posts: 41
Joined: Wed Mar 14, 2012 5:21 am

Re: Something Fun :D

Postby egami » Wed Mar 14, 2012 10:52 am

I know what it does..
I just don't quite see the humor in it..
User avatar
egami
php-forum GURU
php-forum GURU
 
Posts: 2197
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Something Fun :D

Postby LarryMade » Thu Mar 15, 2012 7:03 am

When I first discovered some programming concepts I found lots of entertainment in the stupidest things.
LarryMade
New php-forum User
New php-forum User
 
Posts: 41
Joined: Wed Mar 14, 2012 5:21 am


Return to Your Scripts

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.