FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Filling an array with random input doesn't quite work
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: solved! Re: Filling an array with random input doesn't quite work (was: Filling an array with random input doesn't quite work) [message #185232 is a reply to message #185217] Thu, 13 March 2014 16:23 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Wed, 12 Mar 2014 22:49:38 +0000, Tim Streater wrote:

> Ricjard Teh Stoopid tried to code something, and this is what escaped
to the internet:

>> $num=rand(1,100);
>> if ($num<100){$num="0".$num;}
>> if ($num<10){$num="0".$num;}

> What is the point if this second "if"? You've already covered that with
> the first.

I think what he means to do is:

$x=40;
$song=array();
while(--$x)$song[$x]=sprintf("http://mroldies.net/audio/19%2d/%2d-%
03d.mp3",$yr=rand(60,69),$yr,rand(1,100));

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: readdir lists randomly
Next Topic: Nested PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue May 14 20:06:38 GMT 2024

Total time taken to generate the page: 0.04131 seconds