fork(4) download
  1. <?php
  2. function apostar($qtdDeDezenas, $qtdDeApostas, $numMaximoDezena){
  3. $apostas = [];
  4. for ($i = 1; $i <= $qtdDeApostas; $i++) {
  5. $dezenas = [];
  6. for ($j = 1; $j <= $qtdDeDezenas; $j++) {
  7. while (count($dezenas) < $qtdDeDezenas) {
  8. $dezenaGerada = str_pad(rand(0, $numMaximoDezena), 2, 0, STR_PAD_LEFT);
  9. if (!in_array($dezenaGerada, $dezenas)) {
  10. $dezenas[] = $dezenaGerada;
  11. }
  12. }
  13. }
  14.  
  15. sort($dezenas, SORT_NUMERIC); // ordernar da dezena menor para maior
  16. $apostas[]['dezenas'] = $dezenas;
  17. }
  18.  
  19. return $apostas;
  20. }
  21.  
  22. $qtdDeDezenas = 6;
  23. $qtdDeApostas = 15;
  24. $numMaximoDezena = 60;
  25.  
  26. $apostas = apostar($qtdDeDezenas, $qtdDeApostas, $numMaximoDezena);
  27.  
  28. echo "<pre>";
  29. print_r($apostas);
  30. echo "<pre>";
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
<pre>Array
(
    [0] => Array
        (
            [dezenas] => Array
                (
                    [0] => 10
                    [1] => 11
                    [2] => 27
                    [3] => 41
                    [4] => 42
                    [5] => 43
                )

        )

    [1] => Array
        (
            [dezenas] => Array
                (
                    [0] => 04
                    [1] => 09
                    [2] => 23
                    [3] => 26
                    [4] => 28
                    [5] => 59
                )

        )

    [2] => Array
        (
            [dezenas] => Array
                (
                    [0] => 05
                    [1] => 14
                    [2] => 20
                    [3] => 32
                    [4] => 37
                    [5] => 56
                )

        )

    [3] => Array
        (
            [dezenas] => Array
                (
                    [0] => 00
                    [1] => 16
                    [2] => 30
                    [3] => 32
                    [4] => 47
                    [5] => 55
                )

        )

    [4] => Array
        (
            [dezenas] => Array
                (
                    [0] => 02
                    [1] => 05
                    [2] => 07
                    [3] => 10
                    [4] => 35
                    [5] => 40
                )

        )

    [5] => Array
        (
            [dezenas] => Array
                (
                    [0] => 27
                    [1] => 34
                    [2] => 37
                    [3] => 40
                    [4] => 43
                    [5] => 45
                )

        )

    [6] => Array
        (
            [dezenas] => Array
                (
                    [0] => 09
                    [1] => 15
                    [2] => 36
                    [3] => 40
                    [4] => 51
                    [5] => 56
                )

        )

    [7] => Array
        (
            [dezenas] => Array
                (
                    [0] => 17
                    [1] => 23
                    [2] => 32
                    [3] => 37
                    [4] => 54
                    [5] => 58
                )

        )

    [8] => Array
        (
            [dezenas] => Array
                (
                    [0] => 02
                    [1] => 09
                    [2] => 45
                    [3] => 46
                    [4] => 51
                    [5] => 53
                )

        )

    [9] => Array
        (
            [dezenas] => Array
                (
                    [0] => 02
                    [1] => 06
                    [2] => 13
                    [3] => 18
                    [4] => 21
                    [5] => 40
                )

        )

    [10] => Array
        (
            [dezenas] => Array
                (
                    [0] => 04
                    [1] => 11
                    [2] => 22
                    [3] => 26
                    [4] => 27
                    [5] => 48
                )

        )

    [11] => Array
        (
            [dezenas] => Array
                (
                    [0] => 02
                    [1] => 22
                    [2] => 29
                    [3] => 35
                    [4] => 44
                    [5] => 59
                )

        )

    [12] => Array
        (
            [dezenas] => Array
                (
                    [0] => 17
                    [1] => 18
                    [2] => 19
                    [3] => 26
                    [4] => 28
                    [5] => 46
                )

        )

    [13] => Array
        (
            [dezenas] => Array
                (
                    [0] => 24
                    [1] => 34
                    [2] => 42
                    [3] => 43
                    [4] => 46
                    [5] => 47
                )

        )

    [14] => Array
        (
            [dezenas] => Array
                (
                    [0] => 03
                    [1] => 14
                    [2] => 19
                    [3] => 31
                    [4] => 37
                    [5] => 50
                )

        )

)
<pre>