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_map('foo', $a); $t = microtime(1) - $t; var_dump($t); $a = range(0,100000); $t = microtime(1); array_map($foo, $a); $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/PnoLo
function name:  (null)
number of ops:  45
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%2FPnoLo%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_map'
         12        SEND_VAL                                                 'foo'
         13        SEND_VAR                                                 !1
         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_map'
         33        SEND_VAR                                                 !0
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                                 
   20    36        INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 1
         38        DO_ICALL                                         $19     
         39        SUB                                              ~20     $19, !2
         40        ASSIGN                                                   !2, ~20
   21    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !2
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PnoLo
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%2FPnoLo%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PnoLo
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%2FPnoLo%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.86 ms | 1400 KiB | 21 Q