3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Course { private $students = array("avi" , "haim" , "maor" , "liran" , "yossi") ; function IteraorThatIMadeUp() { foreach ($this->students as $student) { yield $student ; } } } $ob = new Course() ; $generator = $ob->IteraorThatIMadeUp() ; $generator2 = clone $generator ; foreach ($generator as $student) { echo $student . "<br>" ; } foreach ($generator2 as $student) { echo $student . "<br>" ; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 13
filename:       /in/gu5KS
function name:  (null)
number of ops:  21
compiled vars:  !0 = $ob, !1 = $generator, !2 = $generator2, !3 = $student
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $4      'Course'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   18     3        INIT_METHOD_CALL                                         !0, 'IteraorThatIMadeUp'
          4        DO_FCALL                                      0  $7      
          5        ASSIGN                                                   !1, $7
   20     6        CLONE                                            ~9      !1
          7        ASSIGN                                                   !2, ~9
   22     8      > FE_RESET_R                                       $11     !1, ->13
          9    > > FE_FETCH_R                                               $11, !3, ->13
   24    10    >   CONCAT                                           ~12     !3, '%3Cbr%3E'
         11        ECHO                                                     ~12
   22    12      > JMP                                                      ->9
         13    >   FE_FREE                                                  $11
   29    14      > FE_RESET_R                                       $13     !2, ->19
         15    > > FE_FETCH_R                                               $13, !3, ->19
   31    16    >   CONCAT                                           ~14     !3, '%3Cbr%3E'
         17        ECHO                                                     ~14
   29    18      > JMP                                                      ->15
         19    >   FE_FREE                                                  $13
   32    20      > RETURN                                                   1

Class Course:
Function iteraorthatimadeup:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 6
filename:       /in/gu5KS
function name:  IteraorThatIMadeUp
number of ops:  8
compiled vars:  !0 = $student
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   GENERATOR_CREATE                                         
    9     1        FETCH_OBJ_R                                      ~1      'students'
          2      > FE_RESET_R                                       $2      ~1, ->6
          3    > > FE_FETCH_R                                               $2, !0, ->6
   11     4    >   YIELD                                                    !0
    9     5      > JMP                                                      ->3
          6    >   FE_FREE                                                  $2
   13     7      > GENERATOR_RETURN                                         

End of function iteraorthatimadeup

End of class Course.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.87 ms | 1399 KiB | 13 Q