3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { public $generator; public function __construct() { $this->generator = (function() { yield from [1,1,2,3,5,8,13,21]; })(); } public function getValue() { while($this->generator->valid()) { $latitude = $this->generator->current(); $this->generator->next(); return $latitude; } throw new RangeException('End of line'); } } $line = new test(); try { for($i = 0; $i < 10; ++$i) { echo $line->getValue(); echo PHP_EOL; } } catch (Exception $e) { echo $e->getMessage(); }
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 = 12, Position 2 = 5
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 5
Branch analysis from position: 12
Branch analysis from position: 5
Found catch point at position: 13
Branch analysis from position: 13
2 jumps found. (Code = 107) Position 1 = 14, Position 2 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zdor7
function name:  (null)
number of ops:  18
compiled vars:  !0 = $line, !1 = $i, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $3      'test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   26     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->10
   27     5    >   INIT_METHOD_CALL                                         !0, 'getValue'
          6        DO_FCALL                                      0  $7      
          7        ECHO                                                     $7
   28     8        ECHO                                                     '%0A'
   26     9        PRE_INC                                                  !1
         10    >   IS_SMALLER                                               !1, 10
         11      > JMPNZ                                                    ~9, ->5
         12    > > JMP                                                      ->17
   30    13  E > > CATCH                                       last         'Exception'
   31    14    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         15        DO_FCALL                                      0  $10     
         16        ECHO                                                     $10
   32    17    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FZdor7%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/Zdor7
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   GENERATOR_CREATE                                         
    8     1        YIELD_FROM                                       ~0      <array>
          2        FREE                                                     ~0
    9     3      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FZdor7%3A7%240

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zdor7
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FZdor7%3A7%240'
    9     1        INIT_DYNAMIC_CALL                                        ~1
          2        DO_FCALL                                      0  $2      
    7     3        ASSIGN_OBJ                                               'generator'
    9     4        OP_DATA                                                  $2
   10     5      > RETURN                                                   null

End of function __construct

Function getvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 1
Branch analysis from position: 13
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 1
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zdor7
function name:  getValue
number of ops:  18
compiled vars:  !0 = $latitude
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > JMP                                                      ->9
   14     1    >   FETCH_OBJ_R                                      ~1      'generator'
          2        INIT_METHOD_CALL                                         ~1, 'current'
          3        DO_FCALL                                      0  $2      
          4        ASSIGN                                                   !0, $2
   15     5        FETCH_OBJ_R                                      ~4      'generator'
          6        INIT_METHOD_CALL                                         ~4, 'next'
          7        DO_FCALL                                      0          
   16     8      > RETURN                                                   !0
   13     9    >   FETCH_OBJ_R                                      ~6      'generator'
         10        INIT_METHOD_CALL                                         ~6, 'valid'
         11        DO_FCALL                                      0  $7      
         12      > JMPNZ                                                    $7, ->1
   18    13    >   NEW                                              $8      'RangeException'
         14        SEND_VAL_EX                                              'End+of+line'
         15        DO_FCALL                                      0          
         16      > THROW                                         0          $8
   19    17*     > RETURN                                                   null

End of function getvalue

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.03 ms | 1399 KiB | 13 Q