3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Lottery($param, $double=1000){ if(empty($param)) return 0; $data = array(); foreach ($param as $k => $v) { $temp = array_fill(0,$v[0]*$double, $v[1]); $data = array_merge($data, $temp); unset($temp); } echo strlen(json_encode($data)); $num = mt_rand(0,99*1000); return $data[$num]; } $param = array( 0=>array(0=>50, 1=>2), 1=>array(0=>30, 1=>3), 2=>array(0=>19.988, 1=>10), 3=>array(0=>0.002, 1=>20), 4=>array(0=>0.01, 1=>50), ); echo Lottery($param);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CJCu2
function name:  (null)
number of ops:  6
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   22     1        INIT_FCALL                                               'lottery'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function lottery:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 25
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 25
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/CJCu2
function name:  Lottery
number of ops:  39
compiled vars:  !0 = $param, !1 = $double, !2 = $data, !3 = $v, !4 = $k, !5 = $temp, !6 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      1000
    3     2        ISSET_ISEMPTY_CV                                         !0
          3      > JMPZ                                                     ~7, ->5
          4    > > RETURN                                                   0
    4     5    >   ASSIGN                                                   !2, <array>
    5     6      > FE_RESET_R                                       $9      !0, ->25
          7    > > FE_FETCH_R                                       ~10     $9, !3, ->25
          8    >   ASSIGN                                                   !4, ~10
    6     9        INIT_FCALL                                               'array_fill'
         10        SEND_VAL                                                 0
         11        FETCH_DIM_R                                      ~12     !3, 0
         12        MUL                                              ~13     !1, ~12
         13        SEND_VAL                                                 ~13
         14        FETCH_DIM_R                                      ~14     !3, 1
         15        SEND_VAL                                                 ~14
         16        DO_ICALL                                         $15     
         17        ASSIGN                                                   !5, $15
    7    18        INIT_FCALL                                               'array_merge'
         19        SEND_VAR                                                 !2
         20        SEND_VAR                                                 !5
         21        DO_ICALL                                         $17     
         22        ASSIGN                                                   !2, $17
    8    23        UNSET_CV                                                 !5
    5    24      > JMP                                                      ->7
         25    >   FE_FREE                                                  $9
   10    26        INIT_FCALL                                               'json_encode'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $19     
         29        STRLEN                                           ~20     $19
         30        ECHO                                                     ~20
   11    31        INIT_FCALL                                               'mt_rand'
         32        SEND_VAL                                                 0
         33        SEND_VAL                                                 99000
         34        DO_ICALL                                         $21     
         35        ASSIGN                                                   !6, $21
   12    36        FETCH_DIM_R                                      ~23     !2, !6
         37      > RETURN                                                   ~23
   13    38*     > RETURN                                                   null

End of function lottery

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.98 ms | 1403 KiB | 22 Q