3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = "my cat is going to the vet"; $ignore = array("my", "is", "to", "the"); $pattern = "~^[a-z]+|\b(?|" . implode("|", $ignore) . ")\b(*SKIP)(*FAIL)|[a-z]+~"; echo "$pattern\n---\n"; echo preg_replace_callback($pattern, function($m) {return ucfirst($m[0]);}, $string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kYKBb
function name:  (null)
number of ops:  17
compiled vars:  !0 = $string, !1 = $ignore, !2 = $pattern
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, 'my+cat+is+going+to+the+vet'
    3     1        ASSIGN                                                       !1, <array>
    4     2        FRAMELESS_ICALL_2                implode             ~5      '%7C', !1
          3        CONCAT                                               ~6      '%7E%5E%5Ba-z%5D%2B%7C%5Cb%28%3F%7C', ~5
          4        CONCAT                                               ~7      ~6, '%29%5Cb%28%2ASKIP%29%28%2AFAIL%29%7C%5Ba-z%5D%2B%7E'
          5        ASSIGN                                                       !2, ~7
    5     6        NOP                                                          
          7        FAST_CONCAT                                          ~9      !2, '%0A---%0A'
          8        ECHO                                                         ~9
    6     9        INIT_FCALL                                                   'preg_replace_callback'
         10        SEND_VAR                                                     !2
         11        DECLARE_LAMBDA_FUNCTION                              ~10     [0]
         12        SEND_VAL                                                     ~10
         13        SEND_VAR                                                     !0
         14        DO_ICALL                                             $11     
         15        ECHO                                                         $11
         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/kYKBb
function name:  {closure:/in/kYKBb:6}
number of ops:  7
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
          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.5.0


preferences:
160.9 ms | 3313 KiB | 15 Q