3v4l.org

run code in 500+ PHP versions simultaneously
<?php function capitalize_after_periods($string='', $delimiters = array()) { foreach ($delimiters as $delimiter) { $temp = explode($delimiter, $string); array_walk($temp, function (&$value) { $value = ucfirst($value); }); $string = implode($temp, $delimiter); } return $string; } $string ="I am a string with several periods.period #1. period #2."; $result = capitalize_after_periods($string, array('.', '. ')); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DMZ0t
function name:  (null)
number of ops:  10
compiled vars:  !0 = $string, !1 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                       !0, 'I+am+a+string+with+several+periods.period+%231.+period+%232.'
   16     1        INIT_FCALL                                                   'capitalize_after_periods'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     <array>
          4        DO_FCALL                                          0  $3      
          5        ASSIGN                                                       !1, $3
   18     6        INIT_FCALL                                                   'var_dump'
          7        SEND_VAR                                                     !1
          8        DO_ICALL                                                     
          9      > RETURN                                                       1

Function capitalize_after_periods:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/DMZ0t
function name:  capitalize_after_periods
number of ops:  20
compiled vars:  !0 = $string, !1 = $delimiters, !2 = $delimiter, !3 = $temp
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                            !0      ''
          1        RECV_INIT                                            !1      <array>
    5     2      > FE_RESET_R                                           $4      !1, ->17
          3    > > FE_FETCH_R                                                   $4, !2, ->17
    7     4    >   INIT_FCALL                                                   'explode'
          5        SEND_VAR                                                     !2
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $5      
          8        ASSIGN                                                       !3, $5
    8     9        INIT_FCALL                                                   'array_walk'
         10        SEND_REF                                                     !3
         11        DECLARE_LAMBDA_FUNCTION                              ~7      [0]
         12        SEND_VAL                                                     ~7
         13        DO_ICALL                                                     
    9    14        FRAMELESS_ICALL_2                implode             ~9      !3, !2
         15        ASSIGN                                                       !0, ~9
    5    16      > JMP                                                          ->3
         17    >   FE_FREE                                                      $4
   11    18      > RETURN                                                       !0
   12    19*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DMZ0t
function name:  {closure:capitalize_after_periods():8}
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'ucfirst'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $1      
          4        ASSIGN                                                       !0, $1
          5      > RETURN                                                       null

End of Dynamic Function 0

End of function capitalize_after_periods

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.52 ms | 2179 KiB | 18 Q