You are here: Re: Need a string of random numbers « PHP Programming Language « IT news, forums, messages
Re: Need a string of random numbers

Posted by Chung Leong on 06/06/06 16:33

TristaSD wrote:
> Thanks, all. Here's how I used this. If I weren't so lazy, I'd count
> the number of pics in a folder so that a user can just upload a pic and
> not mess with the $total_number variable in the code :)
>
> <?
> $total_number = 6; // Total number of pics
>
> for ($i = 1; $i <= $total_number; $i++) {
> $string_to_shuffle = $string_to_shuffle . $i;
> }
>
> $string_to_shuffle = str_shuffle ($string_to_shuffle);
>
> for ($counter = 0; $counter <= strlen ($string_to_shuffle) - 1;
> $counter++) {
> echo ("<img src='images/gaslogo_");
> echo (substr ($string_to_shuffle, $counter, 1));
> echo (".jpg' alt='some ALT text' ");
> echo (substr ($string_to_shuffle, $counter, 1));
> echo ("' /><br />\n");
> }
> ?>
>
> Also, is it a good practice to break echo's like that, or should I
> write them as one echo statement (sorry for the drift) ?

If you do it the first way you will go blind. If you do it the second
way, the leprechauns will get you.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация