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) { md5($name); } echo microtime(true) - $start; unset($start); echo str_repeat(PHP_EOL, 2); $start = microtime(true) . PHP_EOL; foreach($users as $name) { md5($name); } echo microtime(true) - $start;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 43
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 43
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 20
filename:       /in/muhPX
function name:  (null)
number of ops:  50
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, ->20
         15    > > FE_FETCH_R                                               $9, !2, ->20
   17    16    >   INIT_FCALL                                               'md5'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   15    19      > JMP                                                      ->15
         20    >   FE_FREE                                                  $9
   20    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $11     
         24        SUB                                              ~12     $11, !1
         25        ECHO                                                     ~12
   22    26        UNSET_CV                                                 !1
   24    27        INIT_FCALL                                               'str_repeat'
         28        SEND_VAL                                                 '%0A'
         29        SEND_VAL                                                 2
         30        DO_ICALL                                         $13     
         31        ECHO                                                     $13
   26    32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $14     
         35        CONCAT                                           ~15     $14, '%0A'
         36        ASSIGN                                                   !1, ~15
   28    37      > FE_RESET_R                                       $17     !0, ->43
         38    > > FE_FETCH_R                                               $17, !2, ->43
   30    39    >   INIT_FCALL                                               'md5'
         40        SEND_VAR                                                 !2
         41        DO_ICALL                                                 
   28    42      > JMP                                                      ->38
         43    >   FE_FREE                                                  $17
   33    44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $19     
         47        SUB                                              ~20     $19, !1
         48        ECHO                                                     ~20
         49      > 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/muhPX
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:
145.06 ms | 1403 KiB | 22 Q