3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo { class Bar { public function baz() { return strlen('Regarding the overhead: Just keep in mind, that a typical application calls built-in functions many thousand times. Even if the difference is small: It exists.'); } } $start = microtime(true); $foo = new Bar; for($x = 0; $x < 10000000; $x++) { $foo->baz(); } echo "Time: " . number_format((microtime(true) - $start) * 1000, 2, ""," ") . ' ms'; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 9
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 9
Branch analysis from position: 14
Branch analysis from position: 9
filename:       /in/b79eq
function name:  (null)
number of ops:  29
compiled vars:  !0 = $start, !1 = $foo, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_NS_FCALL_BY_NAME                                    'Foo%5Cmicrotime'
          1        SEND_VAL_EX                                              <true>
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !0, $3
   10     4        NEW                                              $5      'Foo%5CBar'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   11     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->12
   12     9    >   INIT_METHOD_CALL                                         !1, 'baz'
         10        DO_FCALL                                      0          
   11    11        PRE_INC                                                  !2
         12    >   IS_SMALLER                                               !2, 10000000
         13      > JMPNZ                                                    ~11, ->9
   14    14    >   INIT_NS_FCALL_BY_NAME                                    'Foo%5Cnumber_format'
         15        INIT_NS_FCALL_BY_NAME                                    'Foo%5Cmicrotime'
         16        SEND_VAL_EX                                              <true>
         17        DO_FCALL                                      0  $12     
         18        SUB                                              ~13     $12, !0
         19        MUL                                              ~14     ~13, 1000
         20        SEND_VAL_EX                                              ~14
         21        SEND_VAL_EX                                              2
         22        SEND_VAL_EX                                              ''
         23        SEND_VAL_EX                                              '+'
         24        DO_FCALL                                      0  $15     
         25        CONCAT                                           ~16     'Time%3A+', $15
         26        CONCAT                                           ~17     ~16, '+ms'
         27        ECHO                                                     ~17
   15    28      > RETURN                                                   1

Class Foo\Bar:
Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b79eq
function name:  baz
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_NS_FCALL_BY_NAME                                    'Foo%5Cstrlen'
          1        SEND_VAL_EX                                              'Regarding+the+overhead%3A+Just+keep+in+mind%2C+that+a+typical+application+calls+built-in+functions+many+thousand+times.+Even+if+the+difference+is+small%3A+It+exists.'
          2        DO_FCALL                                      0  $0      
          3      > RETURN                                                   $0
    6     4*     > RETURN                                                   null

End of function baz

End of class Foo\Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.41 ms | 1400 KiB | 19 Q