3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "tHe iPad hAS gONE ouT of STOCK PoWER uP YOur iPhone wHAT moDEL is YOUR aPPLE iPHOne", "fly the chopper to the helipad. an audiphone is a type of hearing aid consisting of a diaphragm that, when placed against the upper teeth, conveys sound vibrations to the inner ear" ]; foreach ($strings as $string) { echo preg_replace_callback('~\bi\K(?:pad|phone)\b|[a-z]+~', function($m) {return ucfirst($m[0]);}, strtolower($string)); echo "\n---\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/NODUv
function name:  (null)
number of ops:  17
compiled vars:  !0 = $strings, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   13     1      > FE_RESET_R                                       $3      !0, ->15
          2    > > FE_FETCH_R                                               $3, !1, ->15
   14     3    >   INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAL                                                 '%7E%5Cbi%5CK%28%3F%3Apad%7Cphone%29%5Cb%7C%5Ba-z%5D%2B%7E'
          5        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          6        SEND_VAL                                                 ~4
          7        INIT_FCALL                                               'strtolower'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        ECHO                                                     $6
   15    13        ECHO                                                     '%0A---%0A'
   13    14      > JMP                                                      ->2
         15    >   FE_FREE                                                  $3
   16    16      > RETURN                                                   1


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

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.64 ms | 1005 KiB | 16 Q