3v4l.org

run code in 300+ PHP versions simultaneously
<?php $selfTable = 'songs'; $relTable = 'artists'; $strings = array( 'id', 'artists.name', '$artist.real_name', '$title' ); foreach($strings as $string) { echo preg_replace_callback('#((?P<both>[^\$]+)|\$(?P<self_field>[\w]+)|\$(?P<table>[\w]+)\.(?P<field>[\w]+))#', function($match) { print_r($match); }, $string); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/omFI8
function name:  (null)
number of ops:  15
compiled vars:  !0 = $selfTable, !1 = $relTable, !2 = $strings, !3 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'songs'
    3     1        ASSIGN                                                   !1, 'artists'
    5     2        ASSIGN                                                   !2, <array>
   12     3      > FE_RESET_R                                       $7      !2, ->13
          4    > > FE_FETCH_R                                               $7, !3, ->13
   13     5    >   INIT_FCALL                                               'preg_replace_callback'
          6        SEND_VAL                                                 '%23%28%28%3FP%3Cboth%3E%5B%5E%5C%24%5D%2B%29%7C%5C%24%28%3FP%3Cself_field%3E%5B%5Cw%5D%2B%29%7C%5C%24%28%3FP%3Ctable%3E%5B%5Cw%5D%2B%29%5C.%28%3FP%3Cfield%3E%5B%5Cw%5D%2B%29%29%23'
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FomFI8%3A13%240'
   15     8        SEND_VAL                                                 ~8
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                         $9      
         11        ECHO                                                     $9
   12    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $7
   16    14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FomFI8%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/omFI8
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   15     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FomFI8%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.19 ms | 1388 KiB | 17 Q