3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { yield 0; yield ['a','b','c'][1]; yield 2; yield 3; yield $element = array('tom','dick','sally','sue')[2]; } try { $o = gen(); foreach($o as $g) { echo $g,' '; echo empty(boolval($g))? 'false' : 'true'; echo "\n"; } } catch (Exception $e) { echo "caught exception"; } finally { echo "Whatever, this line will always run\n"; } $names = array(array("Rasmus","Lerdorf"), array("Andi","Gutmans"),array("Zeev","Suraski")); foreach ($names as list($fname,$lname)) { echo $fname, "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 162) Position 1 = 22, Position 2 = 21
Branch analysis from position: 22
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 35
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 35
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
Branch analysis from position: 16
Found catch point at position: 18
Branch analysis from position: 18
2 jumps found. (Code = 107) Position 1 = 19, Position 2 = -2
Branch analysis from position: 19
2 jumps found. (Code = 162) Position 1 = 22, Position 2 = 21
Branch analysis from position: 22
Branch analysis from position: 21
filename:       /in/QFPTL
function name:  (null)
number of ops:  37
compiled vars:  !0 = $o, !1 = $g, !2 = $e, !3 = $names, !4 = $fname, !5 = $lname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'gen'
          1        DO_FCALL                                      0  $7      
          2        ASSIGN                                                   !0, $7
   13     3      > FE_RESET_R                                       $9      !0, ->16
          4    > > FE_FETCH_R                                               $9, !1, ->16
   14     5    >   ECHO                                                     !1
          6        ECHO                                                     '+'
   15     7        BOOL                                             ~10     !1
          8        BOOL_NOT                                         ~11     ~10
          9      > JMPZ                                                     ~11, ->12
         10    >   QM_ASSIGN                                        ~12     'false'
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~12     'true'
         13    >   ECHO                                                     ~12
   16    14        ECHO                                                     '%0A'
   13    15      > JMP                                                      ->4
         16    >   FE_FREE                                                  $9
         17      > JMP                                                      ->20
   19    18  E > > CATCH                                       last         'Exception'
   20    19    >   ECHO                                                     'caught+exception'
   22    20    > > FAST_CALL                                                ->22
         21    > > JMP                                                      ->24
   23    22    >   ECHO                                                     'Whatever%2C+this+line+will+always+run%0A'
         23      > FAST_RET                                                 
   25    24    >   ASSIGN                                                   !3, <array>
   26    25      > FE_RESET_R                                       $14     !3, ->35
         26    > > FE_FETCH_R                                               $14, $15, ->35
         27    >   FETCH_LIST_R                                     $16     $15, 0
         28        ASSIGN                                                   !4, $16
         29        FETCH_LIST_R                                     $18     $15, 1
         30        ASSIGN                                                   !5, $18
         31        FREE                                                     $15
   27    32        ECHO                                                     !4
         33        ECHO                                                     '%0A'
   26    34      > JMP                                                      ->26
         35    >   FE_FREE                                                  $14
   29    36      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/QFPTL
function name:  gen
number of ops:  10
compiled vars:  !0 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        YIELD                                                    0
    4     2        FETCH_DIM_R                                      ~2      <array>, 1
          3        YIELD                                                    ~2
    5     4        YIELD                                                    2
    6     5        YIELD                                                    3
    7     6        FETCH_DIM_R                                      ~6      <array>, 2
          7        ASSIGN                                           ~7      !0, ~6
          8        YIELD                                                    ~7
    9     9      > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
194.93 ms | 1394 KiB | 14 Q