3v4l.org

run code in 300+ PHP versions simultaneously
<?php function out() { while ($v = yield) { print "Received $v.\n"; yield "($v)"; } print "Close\n"; } $out = out(); print "Current: " . $out->current() . "\n"; print "Current: " . $out->current() . "\n"; $out->send('A'); print "Current: " . $out->current() . "\n"; print "Current: " . $out->current() . "\n"; $out->send('B'); print "Current: " . $out->current() . "\n"; print "Current: " . $out->current() . "\n"; $out->send(NULL); print "Current: " . $out->current() . "\n"; print "Current: " . $out->current() . "\n"; $out->send('C'); print "Current: " . $out->current() . "\n"; print "Current: " . $out->current() . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hOY1I
function name:  (null)
number of ops:  66
compiled vars:  !0 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'out'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   12     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0  $3      
          5        CONCAT                                           ~4      'Current%3A+', $3
          6        CONCAT                                           ~5      ~4, '%0A'
          7        ECHO                                                     ~5
   13     8        INIT_METHOD_CALL                                         !0, 'current'
          9        DO_FCALL                                      0  $6      
         10        CONCAT                                           ~7      'Current%3A+', $6
         11        CONCAT                                           ~8      ~7, '%0A'
         12        ECHO                                                     ~8
   14    13        INIT_METHOD_CALL                                         !0, 'send'
         14        SEND_VAL_EX                                              'A'
         15        DO_FCALL                                      0          
   15    16        INIT_METHOD_CALL                                         !0, 'current'
         17        DO_FCALL                                      0  $10     
         18        CONCAT                                           ~11     'Current%3A+', $10
         19        CONCAT                                           ~12     ~11, '%0A'
         20        ECHO                                                     ~12
   16    21        INIT_METHOD_CALL                                         !0, 'current'
         22        DO_FCALL                                      0  $13     
         23        CONCAT                                           ~14     'Current%3A+', $13
         24        CONCAT                                           ~15     ~14, '%0A'
         25        ECHO                                                     ~15
   17    26        INIT_METHOD_CALL                                         !0, 'send'
         27        SEND_VAL_EX                                              'B'
         28        DO_FCALL                                      0          
   18    29        INIT_METHOD_CALL                                         !0, 'current'
         30        DO_FCALL                                      0  $17     
         31        CONCAT                                           ~18     'Current%3A+', $17
         32        CONCAT                                           ~19     ~18, '%0A'
         33        ECHO                                                     ~19
   19    34        INIT_METHOD_CALL                                         !0, 'current'
         35        DO_FCALL                                      0  $20     
         36        CONCAT                                           ~21     'Current%3A+', $20
         37        CONCAT                                           ~22     ~21, '%0A'
         38        ECHO                                                     ~22
   20    39        INIT_METHOD_CALL                                         !0, 'send'
         40        SEND_VAL_EX                                              null
         41        DO_FCALL                                      0          
   21    42        INIT_METHOD_CALL                                         !0, 'current'
         43        DO_FCALL                                      0  $24     
         44        CONCAT                                           ~25     'Current%3A+', $24
         45        CONCAT                                           ~26     ~25, '%0A'
         46        ECHO                                                     ~26
   22    47        INIT_METHOD_CALL                                         !0, 'current'
         48        DO_FCALL                                      0  $27     
         49        CONCAT                                           ~28     'Current%3A+', $27
         50        CONCAT                                           ~29     ~28, '%0A'
         51        ECHO                                                     ~29
   23    52        INIT_METHOD_CALL                                         !0, 'send'
         53        SEND_VAL_EX                                              'C'
         54        DO_FCALL                                      0          
   24    55        INIT_METHOD_CALL                                         !0, 'current'
         56        DO_FCALL                                      0  $31     
         57        CONCAT                                           ~32     'Current%3A+', $31
         58        CONCAT                                           ~33     ~32, '%0A'
         59        ECHO                                                     ~33
   25    60        INIT_METHOD_CALL                                         !0, 'current'
         61        DO_FCALL                                      0  $34     
         62        CONCAT                                           ~35     'Current%3A+', $34
         63        CONCAT                                           ~36     ~35, '%0A'
         64        ECHO                                                     ~36
         65      > RETURN                                                   1

Function out:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 2
Branch analysis from position: 13
Branch analysis from position: 2
filename:       /in/hOY1I
function name:  out
number of ops:  15
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1      > JMP                                                      ->10
    5     2    >   ROPE_INIT                                     3  ~2      'Received+'
          3        ROPE_ADD                                      1  ~2      ~2, !0
          4        ROPE_END                                      2  ~1      ~2, '.%0A'
          5        ECHO                                                     ~1
    6     6        ROPE_INIT                                     3  ~5      '%28'
          7        ROPE_ADD                                      1  ~5      ~5, !0
          8        ROPE_END                                      2  ~4      ~5, '%29'
          9        YIELD                                                    ~4
    4    10    >   YIELD                                            $8      
         11        ASSIGN                                           ~9      !0, $8
         12      > JMPNZ                                                    ~9, ->2
    8    13    >   ECHO                                                     'Close%0A'
    9    14      > GENERATOR_RETURN                                         

End of function out

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.17 ms | 1403 KiB | 14 Q