3v4l.org

run code in 300+ PHP versions simultaneously
<?php //$input = file_get_contents('php://stdin','r'); //$params = explode("\n",$input); $params = [3,3,60,100]; $probes = shift_array($params); function silnia($n) { return ($n <= 1) ? 1 : gmp_mul($n, silnia($n-1)); } function z($silnia) { $strSilnia = (string)$silnia; $zeroCount = 0; for ($i = strlen($strSilnia)-1; $i >= 0; $i--) { if ($strSilnia[$i] == 0) $zeroCount += 1; else break; } echo $zeroCount.PHP_EOL; } for ($i = 0; $i < $probes; $i++) { z(silnia($params[$i])); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 7
Branch analysis from position: 17
Branch analysis from position: 7
filename:       /in/lB5HJ
function name:  (null)
number of ops:  18
compiled vars:  !0 = $params, !1 = $probes, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    6     1        INIT_FCALL_BY_NAME                                       'shift_array'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   25     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->15
   27     7    >   INIT_FCALL                                               'z'
          8        INIT_FCALL                                               'silnia'
          9        FETCH_DIM_R                                      ~7      !0, !2
         10        SEND_VAL                                                 ~7
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        DO_FCALL                                      0          
   25    14        PRE_INC                                                  !2
         15    >   IS_SMALLER                                               !2, !1
         16      > JMPNZ                                                    ~11, ->7
   28    17    > > RETURN                                                   1

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

End of function silnia

Function z:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
Branch analysis from position: 8
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
filename:       /in/lB5HJ
function name:  z
number of ops:  20
compiled vars:  !0 = $silnia, !1 = $strSilnia, !2 = $zeroCount, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        CAST                                          6  ~4      !0
          2        ASSIGN                                                   !1, ~4
   16     3        ASSIGN                                                   !2, 0
   17     4        STRLEN                                           ~7      !1
          5        SUB                                              ~8      ~7, 1
          6        ASSIGN                                                   !3, ~8
          7      > JMP                                                      ->15
   19     8    >   FETCH_DIM_R                                      ~10     !1, !3
          9        IS_EQUAL                                                 ~10, 0
         10      > JMPZ                                                     ~11, ->13
         11    >   ASSIGN_OP                                     1          !2, 1
         12      > JMP                                                      ->14
   20    13    > > JMP                                                      ->17
   17    14    >   PRE_DEC                                                  !3
         15    >   IS_SMALLER_OR_EQUAL                                      0, !3
         16      > JMPNZ                                                    ~14, ->8
   22    17    >   CONCAT                                           ~15     !2, '%0A'
         18        ECHO                                                     ~15
   23    19      > RETURN                                                   null

End of function z

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.01 ms | 1394 KiB | 18 Q