3v4l.org

run code in 300+ PHP versions simultaneously
<?php function couldBeDividedBy5($number) { $last_digit = substr($number, -1); return ($last_digit == '5' || $last_digit == '0'); } function couldBeDividedBy3($number) { if (strlen($number) > 1) { return couldBeDividedBy3(array_sum(str_split($number))); } else { return ($number == '3' || $number == '6' || $number == '9' || $number == '0'); } } function fizzbuzz($from, $to) { if ($from > $to) { return; } if (couldBeDividedBy5($from) || couldBeDividedBy3($from)) { if (couldBeDividedBy3($from)) { echo 'Fizz'; } if (couldBeDividedBy5($from)) { echo 'Buzz'; } } else echo $from; echo PHP_EOL; return fizzbuzz($from + 1, $to); } fizzbuzz(0, 20);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qnhuS
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   INIT_FCALL                                               'fizzbuzz'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 20
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function couldbedividedby5:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/qnhuS
function name:  couldBeDividedBy5
number of ops:  12
compiled vars:  !0 = $number, !1 = $last_digit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 -1
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    6     6        IS_EQUAL                                         ~4      !1, '5'
          7      > JMPNZ_EX                                         ~4      ~4, ->10
          8    >   IS_EQUAL                                         ~5      !1, '0'
          9        BOOL                                             ~4      ~5
         10    > > RETURN                                                   ~4
    7    11*     > RETURN                                                   null

End of function couldbedividedby5

Function couldbedividedby3:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 47) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
2 jumps found. (Code = 47) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 47) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 22
Branch analysis from position: 19
filename:       /in/qnhuS
function name:  couldBeDividedBy3
number of ops:  27
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        STRLEN                                           ~1      !0
          2        IS_SMALLER                                               1, ~1
          3      > JMPZ                                                     ~2, ->15
   13     4    >   INIT_FCALL_BY_NAME                                       'couldBeDividedBy3'
          5        INIT_FCALL                                               'array_sum'
          6        INIT_FCALL                                               'str_split'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                         $4      
         11        SEND_VAR_NO_REF_EX                                       $4
         12        DO_FCALL                                      0  $5      
         13      > RETURN                                                   $5
         14*       JMP                                                      ->26
   17    15    >   IS_EQUAL                                         ~6      !0, '3'
         16      > JMPNZ_EX                                         ~6      ~6, ->19
         17    >   IS_EQUAL                                         ~7      !0, '6'
         18        BOOL                                             ~6      ~7
         19    > > JMPNZ_EX                                         ~6      ~6, ->22
         20    >   IS_EQUAL                                         ~8      !0, '9'
         21        BOOL                                             ~6      ~8
         22    > > JMPNZ_EX                                         ~6      ~6, ->25
         23    >   IS_EQUAL                                         ~9      !0, '0'
         24        BOOL                                             ~6      ~9
         25    > > RETURN                                                   ~6
   19    26*     > RETURN                                                   null

End of function couldbedividedby3

Function fizzbuzz:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 25
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 19
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/qnhuS
function name:  fizzbuzz
number of ops:  34
compiled vars:  !0 = $from, !1 = $to
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2        IS_SMALLER                                               !1, !0
          3      > JMPZ                                                     ~2, ->5
   25     4    > > RETURN                                                   null
   28     5    >   INIT_FCALL                                               'couldbedividedby5'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $3      
          8      > JMPNZ_EX                                         ~4      $3, ->13
          9    >   INIT_FCALL                                               'couldbedividedby3'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0  $5      
         12        BOOL                                             ~4      $5
         13    > > JMPZ                                                     ~4, ->25
   30    14    >   INIT_FCALL                                               'couldbedividedby3'
         15        SEND_VAR                                                 !0
         16        DO_FCALL                                      0  $6      
         17      > JMPZ                                                     $6, ->19
   32    18    >   ECHO                                                     'Fizz'
   34    19    >   INIT_FCALL                                               'couldbedividedby5'
         20        SEND_VAR                                                 !0
         21        DO_FCALL                                      0  $7      
         22      > JMPZ                                                     $7, ->24
   36    23    >   ECHO                                                     'Buzz'
         24    > > JMP                                                      ->26
   40    25    >   ECHO                                                     !0
   41    26    >   ECHO                                                     '%0A'
   43    27        INIT_FCALL_BY_NAME                                       'fizzbuzz'
         28        ADD                                              ~8      !0, 1
         29        SEND_VAL_EX                                              ~8
         30        SEND_VAR_EX                                              !1
         31        DO_FCALL                                      0  $9      
         32      > RETURN                                                   $9
   44    33*     > RETURN                                                   null

End of function fizzbuzz

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.14 ms | 1411 KiB | 24 Q