3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = <<<'EOD' NW Brockville Se Nashville N Brockville S Nashville E Brockville W Nashville PE Springfield Kr Nashville Sete Nevers EOD; echo preg_replace_callback('~^([ns]?[ew]?\b ?)(?:^[a-z]{2} )?~mi', fn($m) => strtoupper($m[1]), $str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XiUcL
function name:  (null)
number of ops:  9
compiled vars:  !0 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'NW+Brockville%0ASe+Nashville%0A%0AN+Brockville%0AS+Nashville%0AE+Brockville%0AW+Nashville%0A%0APE+Springfield%0AKr+Nashville%0A%0ASete%0ANevers%0A'
   20     1        INIT_FCALL                                                   'preg_replace_callback'
          2        SEND_VAL                                                     '%7E%5E%28%5Bns%5D%3F%5Bew%5D%3F%5Cb+%3F%29%28%3F%3A%5E%5Ba-z%5D%7B2%7D+%29%3F%7Emi'
          3        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
          4        SEND_VAL                                                     ~2
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $3      
          7        ECHO                                                         $3
          8      > 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/XiUcL
function name:  {closure:/in/XiUcL:20}
number of ops:  7
compiled vars:  !0 = $m
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
          0  E >   RECV                                                 !0      
          1        INIT_FCALL                                                   'strtoupper'
          2        FETCH_DIM_R                                          ~1      !0, 1
          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:
207.74 ms | 2033 KiB | 15 Q