3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = 'test/test/foo/bar/baz.php'; $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { in_array(pathinfo( $filename, PATHINFO_EXTENSION ), ['php', 'phtml']); } echo 'in_array: ' . ( microtime(true) - $start ) . "\n"; $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { preg_match('/\.(?:php|phtml)/i', $filename); } echo 'preg: ' . ( microtime(true) - $start );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 7
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 29
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 29
Branch analysis from position: 36
Branch analysis from position: 29
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 7
Branch analysis from position: 16
Branch analysis from position: 7
filename:       /in/Qv39v
function name:  (null)
number of ops:  43
compiled vars:  !0 = $filename, !1 = $start, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'test%2Ftest%2Ffoo%2Fbar%2Fbaz.php'
    6     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    7     5        ASSIGN                                                   !2, 0
          6      > JMP                                                      ->14
    8     7    >   INIT_FCALL                                               'pathinfo'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 4
         10        DO_ICALL                                         $7      
         11        IN_ARRAY                                         ~8      $7, <array>
         12        FREE                                                     ~8
    7    13        PRE_INC                                                  !2
         14    >   IS_SMALLER                                               !2, 1000000
         15      > JMPNZ                                                    ~10, ->7
   10    16    >   INIT_FCALL                                               'microtime'
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $11     
         19        SUB                                              ~12     $11, !1
         20        CONCAT                                           ~13     'in_array%3A+', ~12
         21        CONCAT                                           ~14     ~13, '%0A'
         22        ECHO                                                     ~14
   12    23        INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $15     
         26        ASSIGN                                                   !1, $15
   13    27        ASSIGN                                                   !2, 0
         28      > JMP                                                      ->34
   14    29    >   INIT_FCALL                                               'preg_match'
         30        SEND_VAL                                                 '%2F%5C.%28%3F%3Aphp%7Cphtml%29%2Fi'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
   13    33        PRE_INC                                                  !2
         34    >   IS_SMALLER                                               !2, 1000000
         35      > JMPNZ                                                    ~20, ->29
   16    36    >   INIT_FCALL                                               'microtime'
         37        SEND_VAL                                                 <true>
         38        DO_ICALL                                         $21     
         39        SUB                                              ~22     $21, !1
         40        CONCAT                                           ~23     'preg%3A+', ~22
         41        ECHO                                                     ~23
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.51 ms | 1466 KiB | 16 Q