3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = "/([a-zA-Z0-9+._-]+)@([a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/"; $template = '<a email-a="%s" email-b="%s">[click to email]</a>'; $str = "bla bla bla firstbit@secondbit.com bla bla bla"; $newStr = preg_replace_callback($pattern, function($matches) use ($template) { [, $local, $host] = $matches; return sprintf($template, $local, $host); }, $str); echo $newStr;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CsPg3
function name:  (null)
number of ops:  13
compiled vars:  !0 = $pattern, !1 = $template, !2 = $str, !3 = $newStr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%28%5Ba-zA-Z0-9%2B._-%5D%2B%29%40%28%5Ba-zA-Z0-9._-%5D%2B%5C.%5Ba-zA-Z0-9_-%5D%2B%29%2F'
    4     1        ASSIGN                                                   !1, '%3Ca+email-a%3D%22%25s%22+email-b%3D%22%25s%22%3E%5Bclick+to+email%5D%3C%2Fa%3E'
    6     2        ASSIGN                                                   !2, 'bla+bla+bla+firstbit%40secondbit.com+bla+bla+bla'
    8     3        INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAR                                                 !0
          5        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
          6        BIND_LEXICAL                                             ~7, !1
   11     7        SEND_VAL                                                 ~7
          8        SEND_VAR                                                 !2
    8     9        DO_ICALL                                         $8      
         10        ASSIGN                                                   !3, $8
   13    11        ECHO                                                     !3
   14    12      > 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/CsPg3
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $matches, !1 = $template, !2 = $local, !3 = $host
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    9     2        QM_ASSIGN                                        ~4      !0
          3        FETCH_LIST_R                                     $5      ~4, 1
          4        ASSIGN                                                   !2, $5
          5        FETCH_LIST_R                                     $7      ~4, 2
          6        ASSIGN                                                   !3, $7
          7        FREE                                                     ~4
   10     8        INIT_FCALL                                               'sprintf'
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !2
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $9      
         13      > RETURN                                                   $9
   11    14*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.53 ms | 1000 KiB | 15 Q