3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($v) { return $v + 1; } $foo = function ($v) { return $v + 1; }; $a = range(0,100000); $t = microtime(1); array_walk($a, 'foo'); $t = microtime(1) - $t; var_dump($t); $a = range(0,100000); $t = microtime(1); array_walk($a, function ($v) { return $v + 1; }); $t = microtime(1) - $t; var_dump($t);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiWEh
function name:  (null)
number of ops:  46
compiled vars:  !0 = $foo, !1 = $a, !2 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLiWEh%3A7%240'
          1        ASSIGN                                                   !0, ~3
   11     2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 0
          4        SEND_VAL                                                 100000
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !1, $5
   12     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
   13    11        INIT_FCALL                                               'array_walk'
         12        SEND_REF                                                 !1
         13        SEND_VAL                                                 'foo'
         14        DO_ICALL                                                 
   14    15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 1
         17        DO_ICALL                                         $10     
         18        SUB                                              ~11     $10, !2
         19        ASSIGN                                                   !2, ~11
   15    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
   17    23        INIT_FCALL                                               'range'
         24        SEND_VAL                                                 0
         25        SEND_VAL                                                 100000
         26        DO_ICALL                                         $14     
         27        ASSIGN                                                   !1, $14
   18    28        INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 1
         30        DO_ICALL                                         $16     
         31        ASSIGN                                                   !2, $16
   19    32        INIT_FCALL                                               'array_walk'
         33        SEND_REF                                                 !1
         34        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLiWEh%3A19%241'
   21    35        SEND_VAL                                                 ~18
         36        DO_ICALL                                                 
   22    37        INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 1
         39        DO_ICALL                                         $20     
         40        SUB                                              ~21     $20, !2
         41        ASSIGN                                                   !2, ~21
   23    42        INIT_FCALL                                               'var_dump'
         43        SEND_VAR                                                 !2
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiWEh
function name:  foo
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
    5     3*     > RETURN                                                   null

End of function foo

Function %00%7Bclosure%7D%2Fin%2FLiWEh%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiWEh
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
    9     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLiWEh%3A7%240

Function %00%7Bclosure%7D%2Fin%2FLiWEh%3A19%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiWEh
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ADD                                              ~1      !0, 1
          2      > RETURN                                                   ~1
   21     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLiWEh%3A19%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.02 ms | 1400 KiB | 21 Q