3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(string $domain): \Generator { if (strtolower($domain) === 'localhost') { return '127.0.0.1'; } return yield from bar(); } function bar() { yield; return "42"; } $foo = foo("localhost"); foreach ($foo as $i) {} var_dump($foo->getReturn()); $foo = foo("not localhost"); foreach ($foo as $i) {} var_dump($foo->getReturn());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 7
filename:       /in/L5IuQ
function name:  (null)
number of ops:  27
compiled vars:  !0 = $foo, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'foo'
          1        SEND_VAL                                                 'localhost'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !0, $2
   16     4      > FE_RESET_R                                       $4      !0, ->7
          5    > > FE_FETCH_R                                               $4, !1, ->7
          6    > > JMP                                                      ->5
          7    >   FE_FREE                                                  $4
   17     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'getReturn'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
   19    13        INIT_FCALL                                               'foo'
         14        SEND_VAL                                                 'not+localhost'
         15        DO_FCALL                                      0  $7      
         16        ASSIGN                                                   !0, $7
   20    17      > FE_RESET_R                                       $9      !0, ->20
         18    > > FE_FETCH_R                                               $9, !1, ->20
         19    > > JMP                                                      ->18
         20    >   FE_FREE                                                  $9
   21    21        INIT_FCALL                                               'var_dump'
         22        INIT_METHOD_CALL                                         !0, 'getReturn'
         23        DO_FCALL                                      0  $10     
         24        SEND_VAR                                                 $10
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/L5IuQ
function name:  foo
number of ops:  13
compiled vars:  !0 = $domain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    4     2        INIT_FCALL                                               'strtolower'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        IS_IDENTICAL                                             $1, 'localhost'
          6      > JMPZ                                                     ~2, ->8
    5     7    > > GENERATOR_RETURN                                         
    7     8    >   INIT_FCALL_BY_NAME                                       'bar'
          9        DO_FCALL                                      0  $3      
         10        YIELD_FROM                                       ~4      $3
         11      > GENERATOR_RETURN                                         
    8    12*     > GENERATOR_RETURN                                         

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/L5IuQ
function name:  bar
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   GENERATOR_CREATE                                         
   11     1        YIELD                                                    
   12     2      > GENERATOR_RETURN                                         
   13     3*     > GENERATOR_RETURN                                         

End of function bar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.68 ms | 1008 KiB | 17 Q