|
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]
|