3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gcf($a, $b) { return ( $b == 0 ) ? ($a):( gcf($b, $a % $b) ); } function lcm($a, $b) { return ( $a / gcf($a,$b) ) * $b; } function lcm_nums($ar) { if (count($ar) > 1) { $ar[] = lcm( array_shift($ar) , array_shift($ar) ); return lcm_nums( $ar ); } else { return $ar[0]; } } $array = array(3,4,5); echo (lcm_nums($array)); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZETIi
function name:  (null)
number of ops:  6
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'lcm_nums'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   21     5      > RETURN                                                   1

Function gcf:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZETIi
function name:  gcf
number of ops:  14
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        IS_EQUAL                                                 !1, 0
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      !0
          5      > JMP                                                      ->12
          6    >   INIT_FCALL_BY_NAME                                       'gcf'
          7        SEND_VAR_EX                                              !1
          8        MOD                                              ~4      !0, !1
          9        SEND_VAL_EX                                              ~4
         10        DO_FCALL                                      0  $5      
         11        QM_ASSIGN                                        ~3      $5
         12    > > RETURN                                                   ~3
    5    13*     > RETURN                                                   null

End of function gcf

Function lcm:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZETIi
function name:  lcm
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'gcf'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $2      
          6        DIV                                              ~3      !0, $2
          7        MUL                                              ~4      !1, ~3
          8      > RETURN                                                   ~4
    8     9*     > RETURN                                                   null

End of function lcm

Function lcm_nums:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZETIi
function name:  lcm_nums
number of ops:  24
compiled vars:  !0 = $ar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        COUNT                                            ~1      !0
          2        IS_SMALLER                                               1, ~1
          3      > JMPZ                                                     ~2, ->21
   11     4    >   INIT_FCALL                                               'lcm'
          5        INIT_FCALL                                               'array_shift'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        INIT_FCALL                                               'array_shift'
         10        SEND_REF                                                 !0
         11        DO_ICALL                                         $5      
         12        SEND_VAR                                                 $5
         13        DO_FCALL                                      0  $6      
         14        ASSIGN_DIM                                               !0
         15        OP_DATA                                                  $6
   12    16        INIT_FCALL_BY_NAME                                       'lcm_nums'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $7      
         19      > RETURN                                                   $7
         20*       JMP                                                      ->23
   14    21    >   FETCH_DIM_R                                      ~8      !0, 0
         22      > RETURN                                                   ~8
   16    23*     > RETURN                                                   null

End of function lcm_nums

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.78 ms | 1402 KiB | 18 Q