3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = range(0, 100000); $keys = array_map(function ($x) { return chr(46+rand(0, 26)) . chr(46+rand(0, 26)) . chr(46+rand(0, 26)) . $x; }, $x); $vars = array_combine($keys, $x); function _ext() { extract(func_get_arg(0)); } function _for() { foreach (func_get_arg(0) as $__k => $__v) { $$__k = $__v; } unset($__k, $__v); } $t = -microtime(TRUE); _ext($vars); echo sprintf('%.4f', $t + microtime(TRUE)) . PHP_EOL; $t = -microtime(TRUE); _for($vars); echo sprintf('%.4f', $t + microtime(TRUE)) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yr5PN
function name:  (null)
number of ops:  53
compiled vars:  !0 = $x, !1 = $keys, !2 = $vars, !3 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 100000
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
    3     5        INIT_FCALL                                               'array_map'
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FYr5PN%3A3%240'
    5     7        SEND_VAL                                                 ~6
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $7      
    3    10        ASSIGN                                                   !1, $7
    6    11        INIT_FCALL                                               'array_combine'
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !2, $9
   19    16        INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $11     
         19        MUL                                              ~12     $11, -1
         20        ASSIGN                                                   !3, ~12
   20    21        INIT_FCALL                                               '_ext'
         22        SEND_VAR                                                 !2
         23        DO_FCALL                                      0          
   21    24        INIT_FCALL                                               'sprintf'
         25        SEND_VAL                                                 '%25.4f'
         26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $15     
         29        ADD                                              ~16     !3, $15
         30        SEND_VAL                                                 ~16
         31        DO_ICALL                                         $17     
         32        CONCAT                                           ~18     $17, '%0A'
         33        ECHO                                                     ~18
   23    34        INIT_FCALL                                               'microtime'
         35        SEND_VAL                                                 <true>
         36        DO_ICALL                                         $19     
         37        MUL                                              ~20     $19, -1
         38        ASSIGN                                                   !3, ~20
   24    39        INIT_FCALL                                               '_for'
         40        SEND_VAR                                                 !2
         41        DO_FCALL                                      0          
   25    42        INIT_FCALL                                               'sprintf'
         43        SEND_VAL                                                 '%25.4f'
         44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $23     
         47        ADD                                              ~24     !3, $23
         48        SEND_VAL                                                 ~24
         49        DO_ICALL                                         $25     
         50        CONCAT                                           ~26     $25, '%0A'
         51        ECHO                                                     ~26
         52      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FYr5PN%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yr5PN
function name:  {closure}
number of ops:  30
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'chr'
          2        INIT_FCALL                                               'rand'
          3        SEND_VAL                                                 0
          4        SEND_VAL                                                 26
          5        DO_ICALL                                         $1      
          6        ADD                                              ~2      46, $1
          7        SEND_VAL                                                 ~2
          8        DO_ICALL                                         $3      
          9        INIT_FCALL                                               'chr'
         10        INIT_FCALL                                               'rand'
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 26
         13        DO_ICALL                                         $4      
         14        ADD                                              ~5      46, $4
         15        SEND_VAL                                                 ~5
         16        DO_ICALL                                         $6      
         17        CONCAT                                           ~7      $3, $6
         18        INIT_FCALL                                               'chr'
         19        INIT_FCALL                                               'rand'
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 26
         22        DO_ICALL                                         $8      
         23        ADD                                              ~9      46, $8
         24        SEND_VAL                                                 ~9
         25        DO_ICALL                                         $10     
         26        CONCAT                                           ~11     ~7, $10
         27        CONCAT                                           ~12     ~11, !0
         28      > RETURN                                                   ~12
    5    29*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FYr5PN%3A3%240

Function _ext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yr5PN
function name:  _ext
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'extract'
          1        INIT_FCALL                                               'func_get_arg'
          2        SEND_VAL                                                 0
          3        DO_ICALL                                         $0      
          4        SEND_VAL                                                 $0
          5        DO_ICALL                                                 
   10     6      > RETURN                                                   null

End of function _ext

Function _for:
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/Yr5PN
function name:  _for
number of ops:  13
compiled vars:  !0 = $__v, !1 = $__k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'func_get_arg'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                         $2      
          3      > FE_RESET_R                                       $3      $2, ->9
          4    > > FE_FETCH_R                                       ~4      $3, !0, ->9
          5    >   ASSIGN                                                   !1, ~4
   14     6        FETCH_W                      local               $6      !1
          7        ASSIGN                                                   $6, !0
   13     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $3
   16    10        UNSET_CV                                                 !1
         11        UNSET_CV                                                 !0
   17    12      > RETURN                                                   null

End of function _for

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.45 ms | 1411 KiB | 33 Q