3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a () { print_r('I was here'); yield 1; yield 2; yield 3; } function b (iterable $i, string $name) { print_r($name); foreach($i as $it) { print_r($it); } print_r(PHP_EOL); print_r(PHP_EOL); } $it = a(); b((array) [1, 2, 3], '[1, 2, 3]'); b((array) 1, '1'); b((array) $it, 'a()'); print_r(array_map(fn ($message) => 'a', (array) $it));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/01o54
function name:  (null)
number of ops:  28
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'a'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   23     3        INIT_FCALL                                               'b'
          4        CAST                                          7  ~3      <array>
          5        SEND_VAL                                                 ~3
          6        SEND_VAL                                                 '%5B1%2C+2%2C+3%5D'
          7        DO_FCALL                                      0          
   24     8        INIT_FCALL                                               'b'
          9        CAST                                          7  ~5      1
         10        SEND_VAL                                                 ~5
         11        SEND_VAL                                                 '1'
         12        DO_FCALL                                      0          
   25    13        INIT_FCALL                                               'b'
         14        CAST                                          7  ~7      !0
         15        SEND_VAL                                                 ~7
         16        SEND_VAL                                                 'a%28%29'
         17        DO_FCALL                                      0          
   27    18        INIT_FCALL                                               'print_r'
         19        INIT_FCALL                                               'array_map'
         20        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         21        SEND_VAL                                                 ~9
         22        CAST                                          7  ~10     !0
         23        SEND_VAL                                                 ~10
         24        DO_ICALL                                         $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                                 
         27      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/01o54
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1      > RETURN                                                   'a'
          2*     > RETURN                                                   null

End of Dynamic Function 0

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/01o54
function name:  a
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        INIT_FCALL                                               'print_r'
          2        SEND_VAL                                                 'I+was+here'
          3        DO_ICALL                                                 
    5     4        YIELD                                                    1
    6     5        YIELD                                                    2
    7     6        YIELD                                                    3
    8     7      > GENERATOR_RETURN                                         

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/01o54
function name:  b
number of ops:  19
compiled vars:  !0 = $i, !1 = $name, !2 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                                 
   13     5      > FE_RESET_R                                       $4      !0, ->11
          6    > > FE_FETCH_R                                               $4, !2, ->11
   14     7    >   INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
   13    10      > JMP                                                      ->6
         11    >   FE_FREE                                                  $4
   17    12        INIT_FCALL                                               'print_r'
         13        SEND_VAL                                                 '%0A'
         14        DO_ICALL                                                 
   18    15        INIT_FCALL                                               'print_r'
         16        SEND_VAL                                                 '%0A'
         17        DO_ICALL                                                 
   19    18      > RETURN                                                   null

End of function b

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.64 ms | 1024 KiB | 19 Q