<?
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년 전
감사합니다. 완벽하게 해결됬습니다.
사하님 정말 감사합니다. ^^
사하님 정말 감사합니다. ^^
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7830 | 9년 전 | 438 | ||
| 7829 |
|
9년 전 | 625 | |
| 7828 | 10년 전 | 553 | ||
| 7827 | 10년 전 | 448 | ||
| 7826 | 10년 전 | 451 | ||
| 7825 | 10년 전 | 493 | ||
| 7824 | 10년 전 | 455 | ||
| 7823 | 10년 전 | 401 | ||
| 7822 | 10년 전 | 374 | ||
| 7821 | 10년 전 | 321 | ||
| 7820 | 10년 전 | 359 | ||
| 7819 |
|
10년 전 | 755 | |
| 7818 | 10년 전 | 405 | ||
| 7817 | 10년 전 | 538 | ||
| 7816 | 10년 전 | 422 | ||
| 7815 | 10년 전 | 621 | ||
| 7814 | 10년 전 | 449 | ||
| 7813 | 10년 전 | 399 | ||
| 7812 | 10년 전 | 412 | ||
| 7811 | 10년 전 | 403 | ||
| 7810 | 10년 전 | 584 | ||
| 7809 | 10년 전 | 516 | ||
| 7808 | 10년 전 | 387 | ||
| 7807 | 10년 전 | 421 | ||
| 7806 |
프로그래머7
|
10년 전 | 1343 | |
| 7805 | 10년 전 | 1290 | ||
| 7804 |
zahir1312
|
10년 전 | 789 | |
| 7803 |
|
10년 전 | 1384 | |
| 7802 | 10년 전 | 473 | ||
| 7801 | 10년 전 | 870 | ||
| 7800 | 10년 전 | 1092 | ||
| 7799 | 10년 전 | 568 | ||
| 7798 | 10년 전 | 524 | ||
| 7797 | 10년 전 | 528 | ||
| 7796 | 10년 전 | 370 | ||
| 7795 | 10년 전 | 523 | ||
| 7794 | 10년 전 | 569 | ||
| 7793 | 10년 전 | 1066 | ||
| 7792 | 10년 전 | 491 | ||
| 7791 | 10년 전 | 571 | ||
| 7790 | 10년 전 | 520 | ||
| 7789 |
fbastore
|
10년 전 | 1459 | |
| 7788 | 10년 전 | 559 | ||
| 7787 | 10년 전 | 418 | ||
| 7786 | 10년 전 | 607 | ||
| 7785 | 10년 전 | 602 | ||
| 7784 | 10년 전 | 656 | ||
| 7783 | 10년 전 | 465 | ||
| 7782 | 10년 전 | 505 | ||
| 7781 | 10년 전 | 911 | ||
| 7780 | 10년 전 | 832 | ||
| 7779 | 10년 전 | 781 | ||
| 7778 | 10년 전 | 370 | ||
| 7777 | 10년 전 | 473 | ||
| 7776 | 10년 전 | 470 | ||
| 7775 | 10년 전 | 417 | ||
| 7774 | 10년 전 | 637 | ||
| 7773 | 10년 전 | 394 | ||
| 7772 | 10년 전 | 751 | ||
| 7771 | 10년 전 | 403 | ||
| 7770 | 10년 전 | 654 | ||
| 7769 | 10년 전 | 404 | ||
| 7768 | 10년 전 | 625 | ||
| 7767 | 10년 전 | 1187 | ||
| 7766 | 10년 전 | 502 | ||
| 7765 | 10년 전 | 551 | ||
| 7764 |
잘살아보자
|
10년 전 | 408 | |
| 7763 |
|
10년 전 | 1471 | |
| 7762 |
Tosea
|
10년 전 | 1073 | |
| 7761 | 10년 전 | 665 | ||
| 7760 |
잘살아보자
|
10년 전 | 701 | |
| 7759 |
잘살아보자
|
10년 전 | 530 | |
| 7758 |
잘살아보자
|
10년 전 | 608 | |
| 7757 | 10년 전 | 1250 | ||
| 7756 |
ITBANK
|
10년 전 | 1267 | |
| 7755 | 10년 전 | 1936 | ||
| 7754 | 10년 전 | 1068 | ||
| 7753 | 10년 전 | 897 | ||
| 7752 | 10년 전 | 1409 | ||
| 7751 |
잘살아보자
|
10년 전 | 550 | |
| 7750 |
잘살아보자
|
10년 전 | 490 | |
| 7749 |
잘살아보자
|
10년 전 | 501 | |
| 7748 |
잘살아보자
|
10년 전 | 516 | |
| 7747 |
잘살아보자
|
10년 전 | 604 | |
| 7746 |
잘살아보자
|
10년 전 | 688 | |
| 7745 |
잘살아보자
|
10년 전 | 927 | |
| 7744 |
잘살아보자
|
10년 전 | 428 | |
| 7743 | 10년 전 | 959 | ||
| 7742 |
starbros
|
10년 전 | 851 | |
| 7741 |
잘살아보자
|
10년 전 | 683 | |
| 7740 |
잘살아보자
|
10년 전 | 557 | |
| 7739 |
잘살아보자
|
10년 전 | 472 | |
| 7738 |
잘살아보자
|
10년 전 | 550 | |
| 7737 |
잘살아보자
|
10년 전 | 520 | |
| 7736 |
잘살아보자
|
10년 전 | 539 | |
| 7735 |
잘살아보자
|
10년 전 | 864 | |
| 7734 |
잘살아보자
|
10년 전 | 438 | |
| 7733 |
잘살아보자
|
10년 전 | 551 | |
| 7732 |
잘살아보자
|
10년 전 | 712 | |
| 7731 |
잘살아보자
|
10년 전 | 630 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기