<?
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년 전
감사합니다. 완벽하게 해결됬습니다.
사하님 정말 감사합니다. ^^
사하님 정말 감사합니다. ^^
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3030 | 14년 전 | 1177 | ||
| 3029 |
|
14년 전 | 1297 | |
| 3028 | 14년 전 | 1049 | ||
| 3027 | 14년 전 | 856 | ||
| 3026 | 14년 전 | 1042 | ||
| 3025 |
마케팅메지션
|
14년 전 | 1163 | |
| 3024 | 14년 전 | 868 | ||
| 3023 | 14년 전 | 856 | ||
| 3022 |
|
14년 전 | 1230 | |
| 3021 | 15년 전 | 1025 | ||
| 3020 | 15년 전 | 916 | ||
| 3019 | 15년 전 | 1074 | ||
| 3018 | 15년 전 | 1245 | ||
| 3017 |
마케팅메지션
|
15년 전 | 946 | |
| 3016 |
|
15년 전 | 980 | |
| 3015 | 15년 전 | 672 | ||
| 3014 | 15년 전 | 894 | ||
| 3013 | 15년 전 | 1105 | ||
| 3012 | 15년 전 | 933 | ||
| 3011 | 15년 전 | 931 | ||
| 3010 | 15년 전 | 1149 | ||
| 3009 |
마케팅메지션
|
15년 전 | 1662 | |
| 3008 | 15년 전 | 591 | ||
| 3007 | 15년 전 | 1027 | ||
| 3006 |
마케팅메지션
|
15년 전 | 1006 | |
| 3005 |
마케팅메지션
|
15년 전 | 907 | |
| 3004 | 15년 전 | 885 | ||
| 3003 |
마케팅메지션
|
15년 전 | 1000 | |
| 3002 | 15년 전 | 784 | ||
| 3001 | 15년 전 | 2011 | ||
| 3000 | 15년 전 | 783 | ||
| 2999 | 15년 전 | 1683 | ||
| 2998 | 15년 전 | 770 | ||
| 2997 |
|
15년 전 | 860 | |
| 2996 | 15년 전 | 949 | ||
| 2995 | 15년 전 | 898 | ||
| 2994 | 15년 전 | 1602 | ||
| 2993 |
마케팅메지션
|
15년 전 | 1014 | |
| 2992 |
마케팅메지션
|
15년 전 | 965 | |
| 2991 |
마케팅메지션
|
15년 전 | 1136 | |
| 2990 | 15년 전 | 975 | ||
| 2989 | 15년 전 | 800 | ||
| 2988 |
|
15년 전 | 950 | |
| 2987 | 15년 전 | 828 | ||
| 2986 | 15년 전 | 1042 | ||
| 2985 | 15년 전 | 589 | ||
| 2984 | 15년 전 | 972 | ||
| 2983 | 15년 전 | 971 | ||
| 2982 | 15년 전 | 913 | ||
| 2981 | 15년 전 | 840 | ||
| 2980 |
마케팅메지션
|
15년 전 | 1179 | |
| 2979 |
마케팅메지션
|
15년 전 | 911 | |
| 2978 |
|
15년 전 | 851 | |
| 2977 |
|
15년 전 | 877 | |
| 2976 | 15년 전 | 819 | ||
| 2975 | 15년 전 | 821 | ||
| 2974 | 15년 전 | 908 | ||
| 2973 | 15년 전 | 1301 | ||
| 2972 | 15년 전 | 687 | ||
| 2971 | 15년 전 | 738 | ||
| 2970 | 15년 전 | 906 | ||
| 2969 | 15년 전 | 922 | ||
| 2968 | 15년 전 | 784 | ||
| 2967 | 15년 전 | 1357 | ||
| 2966 | 15년 전 | 866 | ||
| 2965 |
|
15년 전 | 1096 | |
| 2964 | 15년 전 | 1486 | ||
| 2963 | 15년 전 | 965 | ||
| 2962 |
|
15년 전 | 987 | |
| 2961 |
|
15년 전 | 892 | |
| 2960 | 15년 전 | 843 | ||
| 2959 | 15년 전 | 1196 | ||
| 2958 | 15년 전 | 943 | ||
| 2957 |
|
15년 전 | 834 | |
| 2956 |
|
15년 전 | 1203 | |
| 2955 |
|
15년 전 | 2350 | |
| 2954 | 15년 전 | 943 | ||
| 2953 | 15년 전 | 1059 | ||
| 2952 |
senseme
|
15년 전 | 1190 | |
| 2951 |
뱌미3059
|
15년 전 | 906 | |
| 2950 |
|
15년 전 | 952 | |
| 2949 | 15년 전 | 1001 | ||
| 2948 | 15년 전 | 877 | ||
| 2947 |
|
15년 전 | 967 | |
| 2946 |
개발조각사
|
15년 전 | 2456 | |
| 2945 |
개발조각사
|
15년 전 | 1776 | |
| 2944 |
개발조각사
|
15년 전 | 6063 | |
| 2943 |
개발조각사
|
15년 전 | 1309 | |
| 2942 |
개발조각사
|
15년 전 | 1574 | |
| 2941 |
개발조각사
|
15년 전 | 1934 | |
| 2940 |
개발조각사
|
15년 전 | 3664 | |
| 2939 |
개발조각사
|
15년 전 | 2996 | |
| 2938 |
개발조각사
|
15년 전 | 2077 | |
| 2937 |
개발조각사
|
15년 전 | 1578 | |
| 2936 |
개발조각사
|
15년 전 | 4027 | |
| 2935 | 15년 전 | 1108 | ||
| 2934 | 15년 전 | 885 | ||
| 2933 | 15년 전 | 1059 | ||
| 2932 | 15년 전 | 984 | ||
| 2931 | 15년 전 | 982 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기