11-28-2007, 11:31 AM
|
#8 (permalink)
|
|
The Acquainted
Join Date: Nov 2007
Location: Sweden
Posts: 106
Thanks: 13
|
My way of outputing a random logo
PHP Code:
function random_logo() {
$szLogo[0] = "mb_v6_logga_800x150.jpg";
$szLogo[1] = "mb_v6_logga_800x150_2.jpg";
$szLogo[2] = "mb_v6_logga_800x150_3.jpg";
$szLogo[3] = "mb_v6_logga_800x150_4.jpg";
$szLogo[4] = "mb_v6_logga_800x150_5.jpg";
$szLogo[5] = "mb_v6_logga_800x150_6.jpg";
$szLogo[6] = "mb_v6_logga_800x150_7.jpg";
$szLogo[7] = "mb_v6_logga_800x150_8.jpg";
$szLogo[8] = "mb_v6_logga_800x150_9.jpg";
$szLogo[9] = "mb_v6_logga_800x150_10.jpg";
$szLogo[10] = "mb_v6_logga_800x150_11.jpg";
$szLogo[11] = "mb_v6_logga_800x150_12.jpg";
$szNumber_of_logos = count($szLogo);
$iRand_nr = mt_rand(0, $szNumber_of_logos);
$szRandomLogo = $szLogo[$iRand_nr];
// If no logo is returned use a standard one
if ($szRandomLogo == "") {
$szRandomLogo = "mb_v6_logga_800x150.jpg";
}
return $szRandomLogo;
}
This is a little function i wrote quickly for a website i had a few years ago, were i wanted to show a random header with the site logo. Itīs not wery effecient i guess neither does it check that the file is actually there so theres room for improvement.
what it does is just return a filename of a logo to display.
Tried to apply your prefered variable namning convention :D
Hope it give someone ispiration.
Canīt remember why i numbered the array thoug.
__________________
Of course the whole point of a doomsday machine, would have been lost if you keep it a secret.
|
|
|
|