3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1() { $str = 'derp'; if ($str != 'files' && $str != 'something' && $str != 'Derrr') { return; } return; } function test2() { $str = 'derp'; switch ($str) { case 'files': case 'something': case 'Derrr': break; default: return; } return; } $start = microtime(); for ($i = 1; $i < 10000; $i++) { test1(); } echo "test1: ".$start - microtime(1); $start = microtime(1); for ($i = 1; $i < 10000; $i++) { test2(); } echo "test2: ".$start - microtime();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 22
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 22
Branch analysis from position: 27
Branch analysis from position: 22
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/L055L
function name:  (null)
number of ops:  33
compiled vars:  !0 = $start, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'microtime'
          1        DO_ICALL                                         $2      
          2        ASSIGN                                                   !0, $2
   28     3        ASSIGN                                                   !1, 1
          4      > JMP                                                      ->8
   29     5    >   INIT_FCALL                                               'test1'
          6        DO_FCALL                                      0          
   28     7        PRE_INC                                                  !1
          8    >   IS_SMALLER                                               !1, 10000
          9      > JMPNZ                                                    ~7, ->5
   31    10    >   INIT_FCALL                                               'microtime'
         11        SEND_VAL                                                 1
         12        DO_ICALL                                         $8      
         13        SUB                                              ~9      !0, $8
         14        CONCAT                                           ~10     'test1%3A+', ~9
         15        ECHO                                                     ~10
   34    16        INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 1
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !0, $11
   35    20        ASSIGN                                                   !1, 1
         21      > JMP                                                      ->25
   36    22    >   INIT_FCALL                                               'test2'
         23        DO_FCALL                                      0          
   35    24        PRE_INC                                                  !1
         25    >   IS_SMALLER                                               !1, 10000
         26      > JMPNZ                                                    ~16, ->22
   39    27    >   INIT_FCALL                                               'microtime'
         28        DO_ICALL                                         $17     
         29        SUB                                              ~18     !0, $17
         30        CONCAT                                           ~19     'test2%3A+', ~18
         31        ECHO                                                     ~19
         32      > RETURN                                                   1

Function test1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
Branch analysis from position: 5
filename:       /in/L055L
function name:  test1
number of ops:  12
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 'derp'
    6     1        IS_NOT_EQUAL                                     ~2      !0, 'files'
          2      > JMPZ_EX                                          ~2      ~2, ->5
          3    >   IS_NOT_EQUAL                                     ~3      !0, 'something'
          4        BOOL                                             ~2      ~3
          5    > > JMPZ_EX                                          ~2      ~2, ->8
          6    >   IS_NOT_EQUAL                                     ~4      !0, 'Derrr'
          7        BOOL                                             ~2      ~4
          8    > > JMPZ                                                     ~2, ->10
    7     9    > > RETURN                                                   null
    9    10    > > RETURN                                                   null
   10    11*     > RETURN                                                   null

End of function test1

Function test2:
Finding entry points
Branch analysis from position: 0
5 jumps found. (Code = 188) Position 1 = 9, Position 2 = 9, Position 3 = 9, Position 4 = 10, Position 5 = 2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
Branch analysis from position: 9
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 9
Branch analysis from position: 9
Branch analysis from position: 9
filename:       /in/L055L
function name:  test2
number of ops:  13
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 'derp'
   16     1      > SWITCH_STRING                                            !0, [ 'files':->9, 'something':->9, 'Derrr':->9, ], ->10
   17     2    >   IS_EQUAL                                                 !0, 'files'
          3      > JMPNZ                                                    ~2, ->9
   18     4    >   IS_EQUAL                                                 !0, 'something'
          5      > JMPNZ                                                    ~2, ->9
   19     6    >   IS_EQUAL                                                 !0, 'Derrr'
          7      > JMPNZ                                                    ~2, ->9
          8    > > JMP                                                      ->10
   20     9    > > JMP                                                      ->11
   22    10    > > RETURN                                                   null
   24    11    > > RETURN                                                   null
   25    12*     > RETURN                                                   null

End of function test2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.53 ms | 1392 KiB | 19 Q