3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i = 0; $cnt = 5000; $placeholders = ['{SEXY}' => 'shmexy', '{PEXY}' => 'HUEXY', '{AXY}' => 'EFFEXY', '{OFFER}' => 'hot', '{TREMBLE}' => 'dremble']; $text = '{OFFER}dgfhdfjhkhj{SEXY}sdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG{PEXY}sdgGDSGsdgGDSGsdgGDSG{PEXY} sdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG{PEXY}sdgGDSGsdgGDSGsdgGDSGsdgGDSG{AXY}sdgGDSGsdgGDSGsdgGDSGsdgGD SG{OFFER}sdgGDSGsdgGDSGsdgGDSG{PEXY}sdgGDSGsdgGDSGsdgGDSGsdgGDSG{AXY}{AXY}sdgGDSGsdgGDSGsdgGDSG{AXY} sdgGDSGsdgGDSGsdgGDSG{OFFER}sdgGDSGsdgGDSGsdgGDSG{OFFER}sdgGDSGsdgGDSGsdgGDSG{sexy}sdgGDSGsdgGDSGsdg GDSGsdgGDSGsdgGDSGsdgGDSG{SEXY}sdgGDSGsdgGDSGsdgGDSG{sexy}234regd{OFFER}fg{OFFEggR}{PEXY}{SEXY}DFhgh fSDGFsGs{TREMBLE}sdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG{SEXY}'; echo "====\n"; $before = microtime(true); while ($i < $cnt) { $text2 = preg_replace_callback( '|{[A-Z_]+}|', function ($matches) use ($placeholders) { return isset($placeholders[$matches[0]]) ? $placeholders[$matches[0]] : $matches[0]; }, $text ); ++$i; } $after = microtime(true); echo ($after - $before) . "\n" . $text2 . PHP_EOL; $before = microtime(true); while ($i < $cnt) { $text3 = str_replace(array_keys($placeholders), array_values($placeholders), $text); ++$i; } $after = microtime(true); echo ($after - $before) . "\n" . $text3 . PHP_EOL;
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 = 10
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 35
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 35
Branch analysis from position: 50
Branch analysis from position: 35
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 10
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/eC7Lo
function name:  (null)
number of ops:  60
compiled vars:  !0 = $i, !1 = $cnt, !2 = $placeholders, !3 = $text, !4 = $before, !5 = $text2, !6 = $after, !7 = $text3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    3     1        ASSIGN                                                   !1, 5000
    4     2        ASSIGN                                                   !2, <array>
    5     3        ASSIGN                                                   !3, '%7BOFFER%7Ddgfhdfjhkhj%7BSEXY%7DsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG%7BPEXY%7DsdgGDSGsdgGDSGsdgGDSG%7BPEXY%7D%0AsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG%7BPEXY%7DsdgGDSGsdgGDSGsdgGDSGsdgGDSG%7BAXY%7DsdgGDSGsdgGDSGsdgGDSGsdgGD%0ASG%7BOFFER%7DsdgGDSGsdgGDSGsdgGDSG%7BPEXY%7DsdgGDSGsdgGDSGsdgGDSGsdgGDSG%7BAXY%7D%7BAXY%7DsdgGDSGsdgGDSGsdgGDSG%7BAXY%7D%0AsdgGDSGsdgGDSGsdgGDSG%7BOFFER%7DsdgGDSGsdgGDSGsdgGDSG%7BOFFER%7DsdgGDSGsdgGDSGsdgGDSG%7Bsexy%7DsdgGDSGsdgGDSGsdg%0AGDSGsdgGDSGsdgGDSGsdgGDSG%7BSEXY%7DsdgGDSGsdgGDSGsdgGDSG%7Bsexy%7D234regd%7BOFFER%7Dfg%7BOFFEggR%7D%7BPEXY%7D%7BSEXY%7DDFhgh%0AfSDGFsGs%7BTREMBLE%7DsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSGsdgGDSG%7BSEXY%7D'
   11     4        ECHO                                                     '%3D%3D%3D%3D%0A'
   12     5        INIT_FCALL                                               'microtime'
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $12     
          8        ASSIGN                                                   !4, $12
   13     9      > JMP                                                      ->19
   14    10    >   INIT_FCALL                                               'preg_replace_callback'
   15    11        SEND_VAL                                                 '%7C%7B%5BA-Z_%5D%2B%7D%7C'
   16    12        DECLARE_LAMBDA_FUNCTION                          ~14     [0]
         13        BIND_LEXICAL                                             ~14, !2
   20    14        SEND_VAL                                                 ~14
   21    15        SEND_VAR                                                 !3
   14    16        DO_ICALL                                         $15     
         17        ASSIGN                                                   !5, $15
   23    18        PRE_INC                                                  !0
   13    19    >   IS_SMALLER                                               !0, !1
         20      > JMPNZ                                                    ~18, ->10
   25    21    >   INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $19     
         24        ASSIGN                                                   !6, $19
   26    25        SUB                                              ~21     !6, !4
         26        CONCAT                                           ~22     ~21, '%0A'
         27        CONCAT                                           ~23     ~22, !5
         28        CONCAT                                           ~24     ~23, '%0A'
         29        ECHO                                                     ~24
   27    30        INIT_FCALL                                               'microtime'
         31        SEND_VAL                                                 <true>
         32        DO_ICALL                                         $25     
         33        ASSIGN                                                   !4, $25
   28    34      > JMP                                                      ->48
   29    35    >   INIT_FCALL                                               'str_replace'
         36        INIT_FCALL                                               'array_keys'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $27     
         39        SEND_VAR                                                 $27
         40        INIT_FCALL                                               'array_values'
         41        SEND_VAR                                                 !2
         42        DO_ICALL                                         $28     
         43        SEND_VAR                                                 $28
         44        SEND_VAR                                                 !3
         45        DO_ICALL                                         $29     
         46        ASSIGN                                                   !7, $29
   30    47        PRE_INC                                                  !0
   28    48    >   IS_SMALLER                                               !0, !1
         49      > JMPNZ                                                    ~32, ->35
   32    50    >   INIT_FCALL                                               'microtime'
         51        SEND_VAL                                                 <true>
         52        DO_ICALL                                         $33     
         53        ASSIGN                                                   !6, $33
   33    54        SUB                                              ~35     !6, !4
         55        CONCAT                                           ~36     ~35, '%0A'
         56        CONCAT                                           ~37     ~36, !7
         57        CONCAT                                           ~38     ~37, '%0A'
         58        ECHO                                                     ~38
         59      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eC7Lo
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $matches, !1 = $placeholders
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   17     2        FETCH_DIM_R                                      ~2      !0, 0
          3        ISSET_ISEMPTY_DIM_OBJ                         0          !1, ~2
          4      > JMPZ                                                     ~3, ->9
   18     5    >   FETCH_DIM_R                                      ~4      !0, 0
          6        FETCH_DIM_R                                      ~5      !1, ~4
          7        QM_ASSIGN                                        ~6      ~5
          8      > JMP                                                      ->11
   19     9    >   FETCH_DIM_R                                      ~7      !0, 0
         10        QM_ASSIGN                                        ~6      ~7
         11    > > RETURN                                                   ~6
   20    12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.46 ms | 1024 KiB | 18 Q