note 78844 added to function.rand
| From: | rootdot at gmail dot com | Date: | Tue, 30 Oct 2007 20:31:04 +0000 |
| Subject: | note 78844 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131833@lists.php.net to get a copy of this message | ||
an easily random function which generates random colored tags for your site :)
like me used at http://yahoz.com
<?php
error_reporting(0);
ini_set("memory_limit" , "9999M");
$limit = 50; # our random key limits
$a = array("Our","Random","Keys");
if($a < $limit) $limit = count($a);
#### randoms ######
function randhex()
{
$num = mt_rand ( 0, 0xffffff ); // trust the library, love the library...
$output = sprintf ( "%06x" , $num ); // muchas smoochas to you, PHP!
return strtoupper($output);
}
# our random fonts
$yazikarakterleri = "Arial
Arial Black
Arial Bold
Arial Bold Italic
Arial Italic
Comic Sans MS
Comic Sans MS Bold Courier
Courier New
Courier New Bold
Courier New Bold Italic
Courier New Italic
Estrangelo Edessa
Franklin Gothic Medium
Franklin Gothic Medium
Italic
Gautami
Georgia
Georgia Bold
Georgia Bold Italic
Georgia Italic Impact
Latha
Lucida Console
Lucida Sans Unicode
Microsoft Sans Serif
Modern MS Sans Serif
MS Serif
Mv Boli
Palatino Linotype
Palatino Linotype Bold
Palatino Linotype Bold Italic
Palatino Linotype Italic
Roman
Script
Small Fonts
Symbol
Symbol
Tahoma
Tahoma Bold
Times New Roman
Times New Roman Bold
Times New Roman Bold Italic
Times New Roman Italic
Trebuchet MS
Trebuchet MS Bold
Trebuchet MS Bold Italic
Trebuchet MS Italic
Tunga
Verdana
Verdana Bold
Verdana Bold Italic Verdana Italic
Webdings
WingDings
WST_Czech
WST_Engl
WST_Fren
WST_Germ
WST_Ital
WST_Span
WST_Swed
";
$yazikarakterleri = explode("
",$yazikarakterleri);
$toplam = count($a)-1;
for($ix=0;$ix<=$limit;$ix++)
{
$icerik = rand(0,$toplam); $icerik = $a[$icerik];
$cici .= "<a href=\"http://www.yahoz.com/id.php?$icerik\"><font
size=\"" . rand(1,3) . "\" face=\"" .
$yazikarakterleri[rand(0,count($yazikarakterleri))-1] . "\" color=\"#" .
randhex() . "\"><strong>$icerik</strong></font></a> , ";
}
echo $cici;
?>
We Love PHP !
Best Regards
----
Server IP: 139.179.10.17
Probable Submitter: 88.231.195.75
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- https://master.php.net/note/edit/78844
Del: integrated -- https://master.php.net/note/delete/78844/integrated
Del: useless -- https://master.php.net/note/delete/78844/useless
Del: bad code -- https://master.php.net/note/delete/78844/bad+code
Del: spam -- https://master.php.net/note/delete/78844/spam
Del: non-english -- https://master.php.net/note/delete/78844/non-english
Del: in docs -- https://master.php.net/note/delete/78844/in+docs
Del: other reasons-- https://master.php.net/note/delete/78844
Reject -- https://master.php.net/note/reject/78844
Search -- https://master.php.net/manage/user-notes.php