3v4l.org

run code in 300+ 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 = 25
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 25
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/mIiX8
function name:  (null)
number of ops:  28
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, ->25
         14    > > FE_FETCH_R                                               $9, !2, ->25
    7    15    >   INIT_FCALL                                               'str_replace'
         16        SEND_VAR                                                 !2
         17        INIT_FCALL                                               'strtoupper'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $11     
         23        ASSIGN                                                   !0, $11
    6    24      > JMP                                                      ->14
         25    >   FE_FREE                                                  $9
    9    26        ECHO                                                     !0
   10    27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
194.32 ms | 1401 KiB | 21 Q