3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str="I am a string with several periods.period #1. period #2."; $strings = explode('.', $str); $titleCased = []; foreach($strings as $s){ $titleCased[] = ucfirst(trim($s)); } echo join(".", $titleCased);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/fWGUW
function name:  (null)
number of ops:  23
compiled vars:  !0 = $str, !1 = $strings, !2 = $titleCased, !3 = $s
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                                                   'explode'
          2        SEND_VAL                                                     '.'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $5      
          5        ASSIGN                                                       !1, $5
    5     6        ASSIGN                                                       !2, <array>
    7     7      > FE_RESET_R                                           $8      !1, ->16
          8    > > FE_FETCH_R                                                   $8, !3, ->16
    8     9    >   INIT_FCALL                                                   'ucfirst'
         10        FRAMELESS_ICALL_1                trim                ~10     !3
         11        SEND_VAL                                                     ~10
         12        DO_ICALL                                             $11     
         13        ASSIGN_DIM                                                   !2
         14        OP_DATA                                                      $11
    7    15      > JMP                                                          ->8
         16    >   FE_FREE                                                      $8
   10    17        INIT_FCALL                                                   'join'
         18        SEND_VAL                                                     '.'
         19        SEND_VAR                                                     !2
         20        DO_ICALL                                             $12     
         21        ECHO                                                         $12
         22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
205.64 ms | 2682 KiB | 16 Q