3v4l.org

run code in 300+ PHP versions simultaneously
<?php function echoFibonacciNumber(int $input) { if ($input < 0) { echo "Invalid input"; } if ($input === 0 || $input === 1) { $output = $input; } else { $fi = (sqrt(5) + 1) / 2; $output = floor(pow($fi, $input) / sqrt(5) + 1 / 2); } echo 'input: '.$input.', output: '.$output; } echo echoFibonacciNumber(6);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t24Fv
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'echofibonaccinumber'
          1        SEND_VAL                                                 6
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function echofibonaccinumber:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
Branch analysis from position: 4
filename:       /in/t24Fv
function name:  echoFibonacciNumber
number of ops:  35
compiled vars:  !0 = $input, !1 = $output, !2 = $fi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        IS_SMALLER                                               !0, 0
          2      > JMPZ                                                     ~3, ->4
    6     3    >   ECHO                                                     'Invalid+input'
    8     4    >   IS_IDENTICAL                                     ~4      !0, 0
          5      > JMPNZ_EX                                         ~4      ~4, ->8
          6    >   IS_IDENTICAL                                     ~5      !0, 1
          7        BOOL                                             ~4      ~5
          8    > > JMPZ                                                     ~4, ->11
    9     9    >   ASSIGN                                                   !1, !0
    8    10      > JMP                                                      ->30
   11    11    >   INIT_FCALL                                               'sqrt'
         12        SEND_VAL                                                 5
         13        DO_ICALL                                         $7      
         14        ADD                                              ~8      $7, 1
         15        DIV                                              ~9      ~8, 2
         16        ASSIGN                                                   !2, ~9
   12    17        INIT_FCALL                                               'floor'
         18        INIT_FCALL                                               'pow'
         19        SEND_VAR                                                 !2
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $11     
         22        INIT_FCALL                                               'sqrt'
         23        SEND_VAL                                                 5
         24        DO_ICALL                                         $12     
         25        DIV                                              ~13     $11, $12
         26        ADD                                              ~14     ~13, 0.5
         27        SEND_VAL                                                 ~14
         28        DO_ICALL                                         $15     
         29        ASSIGN                                                   !1, $15
   15    30    >   CONCAT                                           ~17     'input%3A+', !0
         31        CONCAT                                           ~18     ~17, '%2C+output%3A+'
         32        CONCAT                                           ~19     ~18, !1
         33        ECHO                                                     ~19
   16    34      > RETURN                                                   null

End of function echofibonaccinumber

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.65 ms | 1446 KiB | 17 Q