3v4l.org

run code in 300+ PHP versions simultaneously
<?php $users = array_fill(0, 10000, 'name'); function userNames($users) { foreach($users as $user) { yield $user; } } $start = microtime(true) . PHP_EOL; foreach(userNames($users) as $name) { echo $name . PHP_EOL; } echo microtime(true) - $start; unset($start); echo str_repeat(PHP_EOL, 2); $start = microtime(true) . PHP_EOL; foreach($users as $name) { echo $name . PHP_EOL; } echo microtime(true) - $start;
Finding entry points
Branch analysis from position: 0
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
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 19
filename:       /in/RSsob
function name:  (null)
number of ops:  48
compiled vars:  !0 = $users, !1 = $start, !2 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'array_fill'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 10000
          3        SEND_VAL                                                 'name'
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
   13     6        INIT_FCALL                                               'microtime'
          7        SEND_VAL                                                 <true>
          8        DO_ICALL                                         $5      
          9        CONCAT                                           ~6      $5, '%0A'
         10        ASSIGN                                                   !1, ~6
   15    11        INIT_FCALL                                               'usernames'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0  $8      
         14      > FE_RESET_R                                       $9      $8, ->19
         15    > > FE_FETCH_R                                               $9, !2, ->19
   17    16    >   CONCAT                                           ~10     !2, '%0A'
         17        ECHO                                                     ~10
   15    18      > JMP                                                      ->15
         19    >   FE_FREE                                                  $9
   20    20        INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $11     
         23        SUB                                              ~12     $11, !1
         24        ECHO                                                     ~12
   22    25        UNSET_CV                                                 !1
   24    26        INIT_FCALL                                               'str_repeat'
         27        SEND_VAL                                                 '%0A'
         28        SEND_VAL                                                 2
         29        DO_ICALL                                         $13     
         30        ECHO                                                     $13
   26    31        INIT_FCALL                                               'microtime'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $14     
         34        CONCAT                                           ~15     $14, '%0A'
         35        ASSIGN                                                   !1, ~15
   28    36      > FE_RESET_R                                       $17     !0, ->41
         37    > > FE_FETCH_R                                               $17, !2, ->41
   30    38    >   CONCAT                                           ~18     !2, '%0A'
         39        ECHO                                                     ~18
   28    40      > JMP                                                      ->37
         41    >   FE_FREE                                                  $17
   33    42        INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $19     
         45        SUB                                              ~20     $19, !1
         46        ECHO                                                     ~20
         47      > RETURN                                                   1

Function usernames:
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/RSsob
function name:  userNames
number of ops:  8
compiled vars:  !0 = $users, !1 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    7     2      > FE_RESET_R                                       $2      !0, ->6
          3    > > FE_FETCH_R                                               $2, !1, ->6
    9     4    >   YIELD                                                    !1
    7     5      > JMP                                                      ->3
          6    >   FE_FREE                                                  $2
   11     7      > GENERATOR_RETURN                                         

End of function usernames

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.83 ms | 1403 KiB | 20 Q