3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str="I am a string with several periods.period #1. period #2. period #3"; preg_match_all("/\.\s*\w/", $str, $matches); $matches[0] = array_unique($matches[0]); foreach($matches[0] as $match){ $str = str_replace($match, strtoupper($match), $str); } echo $str;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/mIiX8
function name:  (null)
number of ops:  25
compiled vars:  !0 = $str, !1 = $matches, !2 = $match
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'I+am+a+string+with+several+periods.period+%231.+period+%232.+period+%233'
    4     1        INIT_FCALL                                                   'preg_match_all'
          2        SEND_VAL                                                     '%2F%5C.%5Cs%2A%5Cw%2F'
          3        SEND_VAR                                                     !0
          4        SEND_REF                                                     !1
          5        DO_ICALL                                                     
    5     6        INIT_FCALL                                                   'array_unique'
          7        FETCH_DIM_R                                          ~6      !1, 0
          8        SEND_VAL                                                     ~6
          9        DO_ICALL                                             $7      
         10        ASSIGN_DIM                                                   !1, 0
         11        OP_DATA                                                      $7
    6    12        FETCH_DIM_R                                          ~8      !1, 0
         13      > FE_RESET_R                                           $9      ~8, ->22
         14    > > FE_FETCH_R                                                   $9, !2, ->22
    7    15    >   INIT_FCALL                                                   'strtoupper'
         16        SEND_VAR                                                     !2
         17        DO_ICALL                                             $10     
         18        FRAMELESS_ICALL_3                str_replace         ~11     !2, $10
         19        OP_DATA                                                      !0
         20        ASSIGN                                                       !0, ~11
    6    21      > JMP                                                          ->14
         22    >   FE_FREE                                                      $9
    9    23        ECHO                                                         !0
   10    24      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.08 ms | 2636 KiB | 16 Q