3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fibonacci(){ $a = 0; $b = 1; while(true) { $a = $a + $b; $b = $a - $b; yield $a; } } $fib = fibonacci(); $fib->current(); $fib->next(); $fib->current();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nkFJm
function name:  (null)
number of ops:  10
compiled vars:  !0 = $fib
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'fibonacci'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0          
   16     5        INIT_METHOD_CALL                                         !0, 'next'
          6        DO_FCALL                                      0          
   17     7        INIT_METHOD_CALL                                         !0, 'current'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Function fibonacci:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/nkFJm
function name:  fibonacci
number of ops:  11
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        ASSIGN                                                   !0, 0
    4     2        ASSIGN                                                   !1, 1
    6     3      > JMP                                                      ->9
    8     4    >   ADD                                              ~4      !0, !1
          5        ASSIGN                                                   !0, ~4
    9     6        SUB                                              ~6      !0, !1
          7        ASSIGN                                                   !1, ~6
   10     8        YIELD                                                    !0
    6     9    > > JMPNZ                                                    <true>, ->4
   12    10    > > GENERATOR_RETURN                                         

End of function fibonacci

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.25 ms | 1398 KiB | 14 Q