3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a() { var_dump('a1'); yield 1; var_dump('a2'); yield 2; var_dump('a3'); yield 3; var_dump('a4'); yield 4; var_dump('a5'); yield 5; } $a = a(); var_dump('after gen'); var_dump($a->valid()); var_dump('after valid'); var_dump($a->current()); var_dump('after current'); $a->next(); var_dump('after next'); $a->send(1); var_dump($a->current()); $a->send(1); var_dump($a->current()); $a->send(1); var_dump($a->current());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6vAUW
function name:  (null)
number of ops:  52
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'a'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   17     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAL                                                 'after+gen'
          5        DO_ICALL                                                 
   18     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'valid'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
   19    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAL                                                 'after+valid'
         13        DO_ICALL                                                 
   20    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !0, 'current'
         16        DO_FCALL                                      0  $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                                 
   21    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAL                                                 'after+current'
         21        DO_ICALL                                                 
   22    22        INIT_METHOD_CALL                                         !0, 'next'
         23        DO_FCALL                                      0          
   23    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAL                                                 'after+next'
         26        DO_ICALL                                                 
   24    27        INIT_METHOD_CALL                                         !0, 'send'
         28        SEND_VAL_EX                                              1
         29        DO_FCALL                                      0          
   25    30        INIT_FCALL                                               'var_dump'
         31        INIT_METHOD_CALL                                         !0, 'current'
         32        DO_FCALL                                      0  $13     
         33        SEND_VAR                                                 $13
         34        DO_ICALL                                                 
   26    35        INIT_METHOD_CALL                                         !0, 'send'
         36        SEND_VAL_EX                                              1
         37        DO_FCALL                                      0          
   27    38        INIT_FCALL                                               'var_dump'
         39        INIT_METHOD_CALL                                         !0, 'current'
         40        DO_FCALL                                      0  $16     
         41        SEND_VAR                                                 $16
         42        DO_ICALL                                                 
   28    43        INIT_METHOD_CALL                                         !0, 'send'
         44        SEND_VAL_EX                                              1
         45        DO_FCALL                                      0          
   29    46        INIT_FCALL                                               'var_dump'
         47        INIT_METHOD_CALL                                         !0, 'current'
         48        DO_FCALL                                      0  $19     
         49        SEND_VAR                                                 $19
         50        DO_ICALL                                                 
         51      > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/6vAUW
function name:  a
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'a1'
          3        DO_ICALL                                                 
    5     4        YIELD                                                    1
    6     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAL                                                 'a2'
          7        DO_ICALL                                                 
    7     8        YIELD                                                    2
    8     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAL                                                 'a3'
         11        DO_ICALL                                                 
    9    12        YIELD                                                    3
   10    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAL                                                 'a4'
         15        DO_ICALL                                                 
   11    16        YIELD                                                    4
   12    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAL                                                 'a5'
         19        DO_ICALL                                                 
   13    20        YIELD                                                    5
   14    21      > GENERATOR_RETURN                                         

End of function a

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.23 ms | 1403 KiB | 16 Q