3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str="I am a string with several periods.period #1. period #2."; preg_match_all("/\.\s*\w/", $str, $matches); 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 = 8, Position 2 = 19
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/LevU5
function name:  (null)
number of ops:  22
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.'
    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                                                 
    6     6        FETCH_DIM_R                                      ~5      !1, 0
          7      > FE_RESET_R                                       $6      ~5, ->19
          8    > > FE_FETCH_R                                               $6, !2, ->19
    7     9    >   INIT_FCALL                                               'str_replace'
         10        SEND_VAR                                                 !2
         11        INIT_FCALL                                               'strtoupper'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $8      
         17        ASSIGN                                                   !0, $8
    6    18      > JMP                                                      ->8
         19    >   FE_FREE                                                  $6
    9    20        ECHO                                                     !0
   10    21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.97 ms | 1400 KiB | 19 Q