3v4l.org

run code in 500+ 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 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 29
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 29
Branch analysis from position: 34
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:  41
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                                                          ->32
   14    29    >   FRAMELESS_ICALL_2                preg_match          ~18     '%2F%5C.%28%3F%3Aphp%7Cphtml%29%2Fi', !0
         30        FREE                                                         ~18
   13    31        PRE_INC                                                      !2
         32    >   IS_SMALLER                                                   !2, 1000000
         33      > JMPNZ                                                        ~20, ->29
   16    34    >   INIT_FCALL                                                   'microtime'
         35        SEND_VAL                                                     <true>
         36        DO_ICALL                                             $21     
         37        SUB                                                  ~22     $21, !1
         38        CONCAT                                               ~23     'preg%3A+', ~22
         39        ECHO                                                         ~23
         40      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.59 ms | 1337 KiB | 15 Q