3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { return json_encode([42]); } function bar () { $result = (yield foo()); yield json_decode($result); } $bar = bar(); var_dump($bar); foreach($bar as $key => $value) { var_dump($key, $value); echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/LfgvS
function name:  (null)
number of ops:  17
compiled vars:  !0 = $bar, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'bar'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   13     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   15     6      > FE_RESET_R                                       $6      !0, ->15
          7    > > FE_FETCH_R                                       ~7      $6, !1, ->15
          8    >   ASSIGN                                                   !2, ~7
   16     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   17    13        ECHO                                                     '%0A'
   15    14      > JMP                                                      ->7
         15    >   FE_FREE                                                  $6
   18    16      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LfgvS
function name:  foo
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'json_encode'
          1        SEND_VAL                                                 <array>
          2        DO_ICALL                                         $0      
          3      > RETURN                                                   $0
    5     4*     > RETURN                                                   null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/LfgvS
function name:  bar
number of ops:  10
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   GENERATOR_CREATE                                         
    8     1        INIT_FCALL                                               'foo'
          2        DO_FCALL                                      0  $1      
          3        YIELD                                            $2      $1
          4        ASSIGN                                                   !0, $2
    9     5        INIT_FCALL                                               'json_decode'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        YIELD                                                    $4
   10     9      > GENERATOR_RETURN                                         

End of function bar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.34 ms | 1403 KiB | 21 Q