<?
for($i=1; $i<46; $i++) {
$i = sprintf("%02d",$i);
$lotto[$i] = $i;
}
shuffle($lotto);
echo "<font color=pink></font> ";
echo $lotto[0]." <font color=silver> </font> ".$lotto[1]." <font color=silver> </font> ".$lotto[2]." <font color=silver> </font> ".$lotto[3]." <font color=silver> </font> ".$lotto[4]." <font color=silver> </font> ".$lotto[5];
?>
로또번호 자동생성 소스인데요. 숫자가 정렬이 되게 하려합니다.
42 25 06 27 45 01 -> 01 06 25 27 42 45 이런식으로요. 부탁드립니다. ^^<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
for($i=1; $i<46; $i++) {
$i = sprintf("%02d",$i);
$lotto[$i] = $i;
}
shuffle($lotto);
echo "<font color=pink></font> ";
echo $lotto[0]." <font color=silver> </font> ".$lotto[1]." <font color=silver> </font> ".$lotto[2]." <font color=silver> </font> ".$lotto[3]." <font color=silver> </font> ".$lotto[4]." <font color=silver> </font> ".$lotto[5];
?>
로또번호 자동생성 소스인데요. 숫자가 정렬이 되게 하려합니다.
42 25 06 27 45 01 -> 01 06 25 27 42 45 이런식으로요. 부탁드립니다. ^^<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
댓글 4개
14년 전
<?
for($i=1; $i<46; $i++) {
$i = sprintf("%02d",$i);
$lotto[$i] = $i;
}
$lotto = array_rand($lotto,6);
echo "<font color=pink></font> ";
echo $lotto[0]." <font color=silver> </font> ".$lotto[1]." <font color=silver> </font> ".$lotto[2]." <font color=silver> </font> ".$lotto[3]." <font color=silver> </font> ".$lotto[4]." <font color=silver> </font> ".$lotto[5];
?>
for($i=1; $i<46; $i++) {
$i = sprintf("%02d",$i);
$lotto[$i] = $i;
}
$lotto = array_rand($lotto,6);
echo "<font color=pink></font> ";
echo $lotto[0]." <font color=silver> </font> ".$lotto[1]." <font color=silver> </font> ".$lotto[2]." <font color=silver> </font> ".$lotto[3]." <font color=silver> </font> ".$lotto[4]." <font color=silver> </font> ".$lotto[5];
?>
14년 전
사하님 너무 감사드립니다.
그런데 이상하게 새로고침하면 또 정렬이 난되는듯하네요. ㅡ.ㅡ
너무 감사드립니다.
추가로 혹시
숫자 생성시 1~9는 앞에 0을 붙혀서 출력하려면 어떻게 해야하는지요?
<?
$arr = range(1,45);
shuffle($arr);
$arr_out = array_slice($arr,0,6);
sort($arr_out);
echo implode(" ",$arr_out);
?>
위 소스를 출력하면 1,2,11,13,15,16 이렇게 단번호에는 0이 안붙네요. ^^
즐거운 하루 되세요.
그런데 이상하게 새로고침하면 또 정렬이 난되는듯하네요. ㅡ.ㅡ
너무 감사드립니다.
추가로 혹시
숫자 생성시 1~9는 앞에 0을 붙혀서 출력하려면 어떻게 해야하는지요?
<?
$arr = range(1,45);
shuffle($arr);
$arr_out = array_slice($arr,0,6);
sort($arr_out);
echo implode(" ",$arr_out);
?>
위 소스를 출력하면 1,2,11,13,15,16 이렇게 단번호에는 0이 안붙네요. ^^
즐거운 하루 되세요.
14년 전
<?
$arr = range(1,45);
shuffle($arr);
$arr_out = array_slice($arr,0,6);
sort($arr_out);
foreach($arr_out as $arr_str)
{
echo sprintf("%02d",$arr_str)." ";
}
?>
$arr = range(1,45);
shuffle($arr);
$arr_out = array_slice($arr,0,6);
sort($arr_out);
foreach($arr_out as $arr_str)
{
echo sprintf("%02d",$arr_str)." ";
}
?>
14년 전
감사합니다. 완벽하게 해결됬습니다.
사하님 정말 감사합니다. ^^
사하님 정말 감사합니다. ^^
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3630 | 14년 전 | 1175 | ||
| 3629 | 14년 전 | 794 | ||
| 3628 | 14년 전 | 1082 | ||
| 3627 | 14년 전 | 3028 | ||
| 3626 | 14년 전 | 1407 | ||
| 3625 | 14년 전 | 791 | ||
| 3624 | 14년 전 | 1585 | ||
| 3623 | 14년 전 | 952 | ||
| 3622 | 14년 전 | 483 | ||
| 3621 | 14년 전 | 2371 | ||
| 3620 | 14년 전 | 772 | ||
| 3619 |
하모니칼수
|
14년 전 | 835 | |
| 3618 | 14년 전 | 1143 | ||
| 3617 | 14년 전 | 1020 | ||
| 3616 |
방황하는중년
|
14년 전 | 1069 | |
| 3615 |
아놔6636
|
14년 전 | 582 | |
| 3614 |
아놔6636
|
14년 전 | 2456 | |
| 3613 | 14년 전 | 876 | ||
| 3612 |
forever
|
14년 전 | 1485 | |
| 3611 |
SaNoRaMyun
|
14년 전 | 1170 | |
| 3610 | 14년 전 | 1188 | ||
| 3609 | 14년 전 | 874 | ||
| 3608 | 14년 전 | 1169 | ||
| 3607 | 14년 전 | 748 | ||
| 3606 | 14년 전 | 761 | ||
| 3605 | 14년 전 | 1585 | ||
| 3604 | 14년 전 | 1336 | ||
| 3603 | 14년 전 | 1143 | ||
| 3602 | 14년 전 | 1193 | ||
| 3601 | 14년 전 | 1920 | ||
| 3600 | 14년 전 | 1496 | ||
| 3599 | 14년 전 | 605 | ||
| 3598 | 14년 전 | 1490 | ||
| 3597 | 14년 전 | 1273 | ||
| 3596 |
anfernee
|
14년 전 | 1355 | |
| 3595 | 14년 전 | 831 | ||
| 3594 | 14년 전 | 870 | ||
| 3593 | 14년 전 | 821 | ||
| 3592 | 14년 전 | 815 | ||
| 3591 | 14년 전 | 1452 | ||
| 3590 | 14년 전 | 780 | ||
| 3589 |
쉽다zzz
|
14년 전 | 1070 | |
| 3588 | 14년 전 | 1352 | ||
| 3587 | 14년 전 | 1400 | ||
| 3586 | 14년 전 | 1089 | ||
| 3585 |
플레이디원
|
14년 전 | 1845 | |
| 3584 |
행복한숭아씨
|
14년 전 | 1173 | |
| 3583 | 14년 전 | 1822 | ||
| 3582 |
|
14년 전 | 1371 | |
| 3581 |
|
14년 전 | 1014 | |
| 3580 |
|
14년 전 | 3098 | |
| 3579 | 14년 전 | 1543 | ||
| 3578 |
|
14년 전 | 1020 | |
| 3577 | 14년 전 | 867 | ||
| 3576 | 14년 전 | 1542 | ||
| 3575 |
|
14년 전 | 959 | |
| 3574 |
visualp
|
14년 전 | 765 | |
| 3573 |
visualp
|
14년 전 | 687 | |
| 3572 |
visualp
|
14년 전 | 1938 | |
| 3571 |
visualp
|
14년 전 | 597 | |
| 3570 | 14년 전 | 844 | ||
| 3569 | 14년 전 | 1600 | ||
| 3568 | 14년 전 | 946 | ||
| 3567 |
순천홈페이지
|
14년 전 | 933 | |
| 3566 | 14년 전 | 1474 | ||
| 3565 |
|
14년 전 | 1155 | |
| 3564 | 14년 전 | 1223 | ||
| 3563 | 14년 전 | 1020 | ||
| 3562 | 14년 전 | 2321 | ||
| 3561 | 14년 전 | 1105 | ||
| 3560 |
|
14년 전 | 831 | |
| 3559 | 14년 전 | 1012 | ||
| 3558 | 14년 전 | 766 | ||
| 3557 |
acting1
|
14년 전 | 795 | |
| 3556 |
acting1
|
14년 전 | 621 | |
| 3555 |
브라이튼스쿨
|
14년 전 | 828 | |
| 3554 | 14년 전 | 1213 | ||
| 3553 | 14년 전 | 1460 | ||
| 3552 | 14년 전 | 913 | ||
| 3551 | 14년 전 | 1067 | ||
| 3550 | 14년 전 | 920 | ||
| 3549 |
|
14년 전 | 1099 | |
| 3548 | 14년 전 | 1379 | ||
| 3547 |
|
14년 전 | 1144 | |
| 3546 |
noseart
|
14년 전 | 1335 | |
| 3545 | 14년 전 | 1110 | ||
| 3544 |
비니1234
|
14년 전 | 1042 | |
| 3543 |
비니1234
|
14년 전 | 1073 | |
| 3542 |
zerocooling
|
14년 전 | 1015 | |
| 3541 | 14년 전 | 1547 | ||
| 3540 | 14년 전 | 1497 | ||
| 3539 |
피디인사이드
|
14년 전 | 1318 | |
| 3538 |
soing
|
14년 전 | 1421 | |
| 3537 | 14년 전 | 1655 | ||
| 3536 |
|
14년 전 | 654 | |
| 3535 | 14년 전 | 1115 | ||
| 3534 | 14년 전 | 471 | ||
| 3533 | 14년 전 | 940 | ||
| 3532 | 14년 전 | 1404 | ||
| 3531 | 14년 전 | 859 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기