3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1|27|31|33'; $separator = '##|##'; $time = microtime(true); var_dump($time); for ($i = 0; $i < 100000; $i++) { $result = str_replace('|', $separator, $input); } $time = microtime(true); var_dump($time); for ($i = 0; $i < 100000; $i++) { $result = ''; $it = new CachingIterator(new ArrayIterator(explode('|', $input)), CachingIterator::FULL_CACHE); foreach ($it as $categoryId) { $result .= $categoryId; if ($it->hasNext()) { $result .= $separator; } } } $time = microtime(true); var_dump($time);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 29
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 43, Position 2 = 50
Branch analysis from position: 43
2 jumps found. (Code = 78) Position 1 = 44, Position 2 = 50
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 49
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
Branch analysis from position: 49
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 29
Branch analysis from position: 54
Branch analysis from position: 29
Branch analysis from position: 50
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 11
Branch analysis from position: 20
Branch analysis from position: 11
filename:       /in/DnIVL
function name:  (null)
number of ops:  62
compiled vars:  !0 = $input, !1 = $separator, !2 = $time, !3 = $i, !4 = $result, !5 = $it, !6 = $categoryId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '1%7C27%7C31%7C33'
    3     1        ASSIGN                                                   !1, '%23%23%7C%23%23'
    5     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !2, $9
    6     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                                 
    7     9        ASSIGN                                                   !3, 0
         10      > JMP                                                      ->18
    8    11    >   INIT_FCALL                                               'str_replace'
         12        SEND_VAL                                                 '%7C'
         13        SEND_VAR                                                 !1
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !4, $13
    7    17        PRE_INC                                                  !3
         18    >   IS_SMALLER                                               !3, 100000
         19      > JMPNZ                                                    ~16, ->11
   10    20    >   INIT_FCALL                                               'microtime'
         21        SEND_VAL                                                 <true>
         22        DO_ICALL                                         $17     
         23        ASSIGN                                                   !2, $17
   11    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                                 
   13    27        ASSIGN                                                   !3, 0
         28      > JMP                                                      ->52
   14    29    >   ASSIGN                                                   !4, ''
   15    30        NEW                                              $22     'CachingIterator'
         31        NEW                                              $23     'ArrayIterator'
         32        INIT_FCALL                                               'explode'
         33        SEND_VAL                                                 '%7C'
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                         $24     
         36        SEND_VAR_NO_REF_EX                                       $24
         37        DO_FCALL                                      0          
         38        SEND_VAR_NO_REF_EX                                       $23
         39        SEND_VAL_EX                                              256
         40        DO_FCALL                                      0          
         41        ASSIGN                                                   !5, $22
   16    42      > FE_RESET_R                                       $28     !5, ->50
         43    > > FE_FETCH_R                                               $28, !6, ->50
   17    44    >   ASSIGN_OP                                     8          !4, !6
   18    45        INIT_METHOD_CALL                                         !5, 'hasNext'
         46        DO_FCALL                                      0  $30     
         47      > JMPZ                                                     $30, ->49
   19    48    >   ASSIGN_OP                                     8          !4, !1
   16    49    > > JMP                                                      ->43
         50    >   FE_FREE                                                  $28
   13    51        PRE_INC                                                  !3
         52    >   IS_SMALLER                                               !3, 100000
         53      > JMPNZ                                                    ~33, ->29
   24    54    >   INIT_FCALL                                               'microtime'
         55        SEND_VAL                                                 <true>
         56        DO_ICALL                                         $34     
         57        ASSIGN                                                   !2, $34
   25    58        INIT_FCALL                                               'var_dump'
         59        SEND_VAR                                                 !2
         60        DO_ICALL                                                 
         61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.56 ms | 1400 KiB | 21 Q