3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { public function _($foo) { return $foo; } } $mem = memory_get_usage(); $timestamp = microtime(true); $base = new Base; $t = function($foo) use ($base) { return $base->_($foo); }; for ($i = 0; $i < 10000; $i++) { $t($i); } $timestampAfter = microtime(true); $memDiff = memory_get_usage() - $mem; $timeDiff = $timestampAfter-$timestamp; var_dump($memDiff, $timeDiff);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 15
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 15
Branch analysis from position: 21
Branch analysis from position: 15
filename:       /in/nocI7
function name:  (null)
number of ops:  36
compiled vars:  !0 = $mem, !1 = $timestamp, !2 = $base, !3 = $t, !4 = $i, !5 = $timestampAfter, !6 = $memDiff, !7 = $timeDiff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        DO_ICALL                                         $8      
          2        ASSIGN                                                   !0, $8
   12     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $10     
          6        ASSIGN                                                   !1, $10
   14     7        NEW                                              $12     'Base'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $12
   15    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FnocI7%3A15%240'
         11        BIND_LEXICAL                                             ~15, !2
         12        ASSIGN                                                   !3, ~15
   19    13        ASSIGN                                                   !4, 0
         14      > JMP                                                      ->19
   20    15    >   INIT_DYNAMIC_CALL                                        !3
         16        SEND_VAR_EX                                              !4
         17        DO_FCALL                                      0          
   19    18        PRE_INC                                                  !4
         19    >   IS_SMALLER                                               !4, 10000
         20      > JMPNZ                                                    ~20, ->15
   23    21    >   INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $21     
         24        ASSIGN                                                   !5, $21
   25    25        INIT_FCALL                                               'memory_get_usage'
         26        DO_ICALL                                         $23     
         27        SUB                                              ~24     $23, !0
         28        ASSIGN                                                   !6, ~24
   26    29        SUB                                              ~26     !5, !1
         30        ASSIGN                                                   !7, ~26
   28    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !6
         33        SEND_VAR                                                 !7
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FnocI7%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nocI7
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $foo, !1 = $base
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   16     2        INIT_METHOD_CALL                                         !1, '_'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
   17     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FnocI7%3A15%240

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

End of function _

End of class Base.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.95 ms | 1400 KiB | 19 Q