3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IterateOver { static function string($str): Generator { for ($i = 0, $len = mb_strlen($str); $i < $len; ++$i) { yield mb_substr($str, $i, 1); } } } foreach (IterateOver::string("meh") as $char) { var_dump($char); } var_dump(IterateOver::string("meh"));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/CU4NR
function name:  (null)
number of ops:  17
compiled vars:  !0 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_STATIC_METHOD_CALL                                  'IterateOver', 'string'
          1        SEND_VAL                                                 'meh'
          2        DO_FCALL                                      0  $1      
          3      > FE_RESET_R                                       $2      $1, ->9
          4    > > FE_FETCH_R                                               $2, !0, ->9
   15     5    >   INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   14     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $2
   18    10        INIT_FCALL                                               'var_dump'
         11        INIT_STATIC_METHOD_CALL                                  'IterateOver', 'string'
         12        SEND_VAL                                                 'meh'
         13        DO_FCALL                                      0  $4      
         14        SEND_VAR                                                 $4
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class IterateOver:
Function string:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
Branch analysis from position: 8
filename:       /in/CU4NR
function name:  string
number of ops:  18
compiled vars:  !0 = $str, !1 = $i, !2 = $len
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    8     2        ASSIGN                                                   !1, 0
          3        INIT_FCALL                                               'mb_strlen'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !2, $4
          7      > JMP                                                      ->15
    9     8    >   INIT_FCALL                                               'mb_substr'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 1
         12        DO_ICALL                                         $6      
         13        YIELD                                                    $6
    8    14        PRE_INC                                                  !1
         15    >   IS_SMALLER                                               !1, !2
         16      > JMPNZ                                                    ~9, ->8
   11    17    > > GENERATOR_RETURN                                         

End of function string

End of class IterateOver.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.2 ms | 1400 KiB | 19 Q