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 = array_shift($params); function silnia($n) { return ($n <= 1) ? 1 : bcmul($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; } return $zeroCount; } for ($i = 0; $i < $probes; $i++) { print (z(silnia($params[$i])).PHP_EOL); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 12
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 12
Branch analysis from position: 24
Branch analysis from position: 12
filename:       /in/TQjX6
function name:  (null)
number of ops:  25
compiled vars:  !0 = $input, !1 = $params, !2 = $probes, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'file_get_contents'
          1        SEND_VAL                                                 'php%3A%2F%2Fstdin'
          2        SEND_VAL                                                 'r'
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
    5     5        ASSIGN                                                   !1, <array>
    6     6        INIT_FCALL                                               'array_shift'
          7        SEND_REF                                                 !1
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !2, $7
   25    10        ASSIGN                                                   !3, 0
         11      > JMP                                                      ->22
   27    12    >   INIT_FCALL                                               'z'
         13        INIT_FCALL                                               'silnia'
         14        FETCH_DIM_R                                      ~10     !1, !3
         15        SEND_VAL                                                 ~10
         16        DO_FCALL                                      0  $11     
         17        SEND_VAR                                                 $11
         18        DO_FCALL                                      0  $12     
         19        CONCAT                                           ~13     $12, '%0A'
         20        ECHO                                                     ~13
   25    21        PRE_INC                                                  !3
         22    >   IS_SMALLER                                               !3, !2
         23      > JMPNZ                                                    ~15, ->12
   29    24    > > 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/TQjX6
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                                       'bcmul'
          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/TQjX6
function name:  z
number of ops:  19
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    > > RETURN                                                   !2
   23    18*     > RETURN                                                   null

End of function z

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.5 ms | 1403 KiB | 19 Q