3v4l.org

run code in 300+ 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 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/fWGUW
function name:  (null)
number of ops:  25
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, ->18
          8    > > FE_FETCH_R                                               $8, !3, ->18
    8     9    >   INIT_FCALL                                               'ucfirst'
         10        INIT_FCALL                                               'trim'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $10     
         13        SEND_VAR                                                 $10
         14        DO_ICALL                                         $11     
         15        ASSIGN_DIM                                               !2
         16        OP_DATA                                                  $11
    7    17      > JMP                                                      ->8
         18    >   FE_FREE                                                  $8
   10    19        INIT_FCALL                                               'join'
         20        SEND_VAL                                                 '.'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $12     
         23        ECHO                                                     $12
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.13 ms | 1005 KiB | 17 Q