3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
based on pS1AR
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/PnoLo
function name:  (null)
number of ops:  46
compiled vars:  !0 = $foo, !1 = $a, !2 = $t
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
   7     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPnoLo0x7f82c0cbb05a'
   9     2        ASSIGN                                                   !0, ~3
  11     3        INIT_FCALL                                               'range'
         4        SEND_VAL                                                 0
         5        SEND_VAL                                                 100000
         6        DO_ICALL                                         $5      
         7        ASSIGN                                                   !1, $5
  12     8        INIT_FCALL                                               'microtime'
         9        SEND_VAL                                                 1
        10        DO_ICALL                                         $7      
        11        ASSIGN                                                   !2, $7
  13    12        INIT_FCALL                                               'array_map'
        13        SEND_VAL                                                 'foo'
        14        SEND_VAR                                                 !1
        15        DO_ICALL                                                 
  14    16        INIT_FCALL                                               'microtime'
        17        SEND_VAL                                                 1
        18        DO_ICALL                                         $10     
        19        SUB                                              ~11     $10, !2
        20        ASSIGN                                                   !2, ~11
  15    21        INIT_FCALL                                               'var_dump'
        22        SEND_VAR                                                 !2
        23        DO_ICALL                                                 
  17    24        INIT_FCALL                                               'range'
        25        SEND_VAL                                                 0
        26        SEND_VAL                                                 100000
        27        DO_ICALL                                         $14     
        28        ASSIGN                                                   !1, $14
  18    29        INIT_FCALL                                               'microtime'
        30        SEND_VAL                                                 1
        31        DO_ICALL                                         $16     
        32        ASSIGN                                                   !2, $16
  19    33        INIT_FCALL                                               'array_map'
        34        SEND_VAR                                                 !0
        35        SEND_VAR                                                 !1
        36        DO_ICALL                                                 
  20    37        INIT_FCALL                                               'microtime'
        38        SEND_VAL                                                 1
        39        DO_ICALL                                         $19     
        40        SUB                                              ~20     $19, !2
        41        ASSIGN                                                   !2, ~20
  21    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
Jump found. 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%2FPnoLo0x7f82c0cbb05a:
Finding entry points
Branch analysis from position: 0
Jump found. 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%2FPnoLo0x7f82c0cbb05a

Generated using Vulcan Logic Dumper, using php 7.2.0