3v4l.org

run code in 300+ PHP versions simultaneously
<?php //29783 Innistrad Champion of the Parish 2.75 3.17 0 2.22 5 2.54 6 function _AVG($args){ /*$count = func_num_args(); $args = func_get_args();*/ $count = count($args); $sum = array_sum($args); return bcdiv($sum,$count,2); } $avg = _AVG(array(3.17,2.22,2.54)); echo 'AVG: '. $avg."\n"; $addmtg = bcadd($avg,3.17,2); echo 'addmtg: '.$addmtg."\n"; $mul95 = bcmul($addmtg,0.95,2); echo 'mul95: '.$mul95."\n"; $div2 = bcdiv($mul95,2,2); echo 'div2: '.$div2."\n\n"; $min = min(array(3.17,2.22,2.54)); echo 'MIN: '.$min."\n"; $mul = bcmul($min,0.99,2); echo 'MUL99: '.$mul;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P7DdA
function name:  (null)
number of ops:  50
compiled vars:  !0 = $avg, !1 = $addmtg, !2 = $mul95, !3 = $div2, !4 = $min, !5 = $mul
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               '_avg'
          1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0  $6      
          3        ASSIGN                                                   !0, $6
   14     4        CONCAT                                           ~8      'AVG%3A+', !0
          5        CONCAT                                           ~9      ~8, '%0A'
          6        ECHO                                                     ~9
   15     7        INIT_FCALL_BY_NAME                                       'bcadd'
          8        SEND_VAR_EX                                              !0
          9        SEND_VAL_EX                                              3.17
         10        SEND_VAL_EX                                              2
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !1, $10
   16    13        CONCAT                                           ~12     'addmtg%3A+', !1
         14        CONCAT                                           ~13     ~12, '%0A'
         15        ECHO                                                     ~13
   17    16        INIT_FCALL_BY_NAME                                       'bcmul'
         17        SEND_VAR_EX                                              !1
         18        SEND_VAL_EX                                              0.95
         19        SEND_VAL_EX                                              2
         20        DO_FCALL                                      0  $14     
         21        ASSIGN                                                   !2, $14
   18    22        CONCAT                                           ~16     'mul95%3A+', !2
         23        CONCAT                                           ~17     ~16, '%0A'
         24        ECHO                                                     ~17
   19    25        INIT_FCALL_BY_NAME                                       'bcdiv'
         26        SEND_VAR_EX                                              !2
         27        SEND_VAL_EX                                              2
         28        SEND_VAL_EX                                              2
         29        DO_FCALL                                      0  $18     
         30        ASSIGN                                                   !3, $18
   20    31        CONCAT                                           ~20     'div2%3A+', !3
         32        CONCAT                                           ~21     ~20, '%0A%0A'
         33        ECHO                                                     ~21
   22    34        INIT_FCALL                                               'min'
         35        SEND_VAL                                                 <array>
         36        DO_ICALL                                         $22     
         37        ASSIGN                                                   !4, $22
   23    38        CONCAT                                           ~24     'MIN%3A+', !4
         39        CONCAT                                           ~25     ~24, '%0A'
         40        ECHO                                                     ~25
   24    41        INIT_FCALL_BY_NAME                                       'bcmul'
         42        SEND_VAR_EX                                              !4
         43        SEND_VAL_EX                                              0.99
         44        SEND_VAL_EX                                              2
         45        DO_FCALL                                      0  $26     
         46        ASSIGN                                                   !5, $26
   25    47        CONCAT                                           ~28     'MUL99%3A+', !5
         48        ECHO                                                     ~28
         49      > RETURN                                                   1

Function _avg:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P7DdA
function name:  _AVG
number of ops:  14
compiled vars:  !0 = $args, !1 = $count, !2 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    8     1        COUNT                                            ~3      !0
          2        ASSIGN                                                   !1, ~3
    9     3        INIT_FCALL                                               'array_sum'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   10     7        INIT_FCALL_BY_NAME                                       'bcdiv'
          8        SEND_VAR_EX                                              !2
          9        SEND_VAR_EX                                              !1
         10        SEND_VAL_EX                                              2
         11        DO_FCALL                                      0  $7      
         12      > RETURN                                                   $7
   11    13*     > RETURN                                                   null

End of function _avg

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.43 ms | 1403 KiB | 18 Q