3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo purebell(0, 3, 3); function purebell($min,$max,$std_deviation,$step=1){ $rand1 = (float)mt_rand()/(float)mt_getrandmax(); $rand2 = (float)mt_rand()/(float)mt_getrandmax(); $gaussian_number = sqrt(-2 * log($rand1)) * cos(2 * M_PI * $rand2); $mean = ($max + $min) / 2; $random_number = ($gaussian_number * $std_deviation) + $mean; $random_number = round($random_number / $step) * $step; if($random_number < $min || $random_number > $max){ $random_number = purebell($min, $max,$std_deviation); } return $random_number; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/usfV6
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL_BY_NAME                                       'purebell'
          1        SEND_VAL_EX                                              0
          2        SEND_VAL_EX                                              3
          3        SEND_VAL_EX                                              3
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
   20     6      > RETURN                                                   1

Function purebell:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 56
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
Branch analysis from position: 49
filename:       /in/usfV6
function name:  purebell
number of ops:  58
compiled vars:  !0 = $min, !1 = $max, !2 = $std_deviation, !3 = $step, !4 = $rand1, !5 = $rand2, !6 = $gaussian_number, !7 = $mean, !8 = $random_number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      1
    8     4        INIT_FCALL                                               'mt_rand'
          5        DO_ICALL                                         $9      
          6        CAST                                          5  ~10     $9
          7        INIT_FCALL                                               'mt_getrandmax'
          8        DO_ICALL                                         $11     
          9        CAST                                          5  ~12     $11
         10        DIV                                              ~13     ~10, ~12
         11        ASSIGN                                                   !4, ~13
    9    12        INIT_FCALL                                               'mt_rand'
         13        DO_ICALL                                         $15     
         14        CAST                                          5  ~16     $15
         15        INIT_FCALL                                               'mt_getrandmax'
         16        DO_ICALL                                         $17     
         17        CAST                                          5  ~18     $17
         18        DIV                                              ~19     ~16, ~18
         19        ASSIGN                                                   !5, ~19
   10    20        INIT_FCALL                                               'sqrt'
         21        INIT_FCALL                                               'log'
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $21     
         24        MUL                                              ~22     $21, -2
         25        SEND_VAL                                                 ~22
         26        DO_ICALL                                         $23     
         27        INIT_FCALL                                               'cos'
         28        MUL                                              ~24     !5, 6.28319
         29        SEND_VAL                                                 ~24
         30        DO_ICALL                                         $25     
         31        MUL                                              ~26     $23, $25
         32        ASSIGN                                                   !6, ~26
   11    33        ADD                                              ~28     !1, !0
         34        DIV                                              ~29     ~28, 2
         35        ASSIGN                                                   !7, ~29
   12    36        MUL                                              ~31     !6, !2
         37        ADD                                              ~32     ~31, !7
         38        ASSIGN                                                   !8, ~32
   13    39        INIT_FCALL                                               'round'
         40        DIV                                              ~34     !8, !3
         41        SEND_VAL                                                 ~34
         42        DO_ICALL                                         $35     
         43        MUL                                              ~36     !3, $35
         44        ASSIGN                                                   !8, ~36
   15    45        IS_SMALLER                                       ~38     !8, !0
         46      > JMPNZ_EX                                         ~38     ~38, ->49
         47    >   IS_SMALLER                                       ~39     !1, !8
         48        BOOL                                             ~38     ~39
         49    > > JMPZ                                                     ~38, ->56
   16    50    >   INIT_FCALL_BY_NAME                                       'purebell'
         51        SEND_VAR_EX                                              !0
         52        SEND_VAR_EX                                              !1
         53        SEND_VAR_EX                                              !2
         54        DO_FCALL                                      0  $40     
         55        ASSIGN                                                   !8, $40
   19    56    > > RETURN                                                   !8
   20    57*     > RETURN                                                   null

End of function purebell

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.46 ms | 1008 KiB | 19 Q