3v4l.org

run code in 300+ 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:  20
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        INIT_FCALL                                               'implode'
          3        SEND_VAL                                                 '%7C'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $5      
          6        CONCAT                                           ~6      '%7E%5E%5Ba-z%5D%2B%7C%5Cb%28%3F%7C', $5
          7        CONCAT                                           ~7      ~6, '%29%5Cb%28%2ASKIP%29%28%2AFAIL%29%7C%5Ba-z%5D%2B%7E'
          8        ASSIGN                                                   !2, ~7
    5     9        NOP                                                      
         10        FAST_CONCAT                                      ~9      !2, '%0A---%0A'
         11        ECHO                                                     ~9
    6    12        INIT_FCALL                                               'preg_replace_callback'
         13        SEND_VAR                                                 !2
         14        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
         15        SEND_VAL                                                 ~10
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $11     
         18        ECHO                                                     $11
         19      > 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}
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.0.0


preferences:
142.25 ms | 1001 KiB | 16 Q