Share this topic on Del.icio.usShare this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on SlashdotShare this topic on StumbleUponShare this topic on TechnoratiShare this topic on TwitterShare this topic on YahooShare this topic on Google buzz

Author Topic: Menampilkan huruf/angka secara acak/random  (Read 1805 times)

0 Members and 1 Guest are viewing this topic.

Offline cyclon

  • Global Moderator
  • *
  • Posts: 185
  • Reputasi: 31

  • Aktivitas bulan ini
    0%
    • Indonesian Informatics Online Community
Menampilkan huruf/angka secara acak/random
« on: 20 October 2008, 12:17:09 »
Code: (php) [Select]
<?php
srand
(time());

$huruf_kecil_acak chr(rand(ord("a"), ord("z")));
$huruf_kapital_acak chr(rand(ord("A"), ord("Z")));
$angka_acak chr(rand(ord("0"), ord("9")));

echo (
"Huruf kecil acak adalah <b>$huruf_kecil_acak</b>");
echo (
"< br>");
echo (
"Huruf kapital acak adalah <b>$huruf_kapital_acak</b>");
echo (
"< br>");
echo (
"Angka acak: <b>$angka_acak</b>");
?>

Contoh Keluaran:

Huruf kecil acak adalah p
Huruf kapital acak adalah H
Angka acak: 0
« Last Edit: 31 March 2009, 12:35:01 by 1nf0rm4t1c5 »
RAR Password di file: http://if.web.id

Forum Informatika

Menampilkan huruf/angka secara acak/random
« on: 20 October 2008, 12:17:09 »
Sponsored Links: