3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'say hello to @elise and @john'; function replace_at_symbol($matches){ return '<a href="/profile/'.$matches[0].'">'.$matches[0].'</a>';} $output = preg_replace_callback("/([@][a-zA-Z-0-9]+)/", "replace_at_symbol", $text); echo $output; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KYJRC
function name:  (null)
number of ops:  9
compiled vars:  !0 = $text, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'say+hello+to+%40elise+and+%40john'
    8     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%28%5B%40%5D%5Ba-zA-Z-0-9%5D%2B%29%2F'
          3        SEND_VAL                                                 'replace_at_symbol'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    9     7        ECHO                                                     !1
   11     8      > RETURN                                                   1

Function replace_at_symbol:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KYJRC
function name:  replace_at_symbol
number of ops:  9
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_DIM_R                                      ~1      !0, 0
          2        CONCAT                                           ~2      '%3Ca+href%3D%22%2Fprofile%2F', ~1
          3        CONCAT                                           ~3      ~2, '%22%3E'
          4        FETCH_DIM_R                                      ~4      !0, 0
          5        CONCAT                                           ~5      ~3, ~4
          6        CONCAT                                           ~6      ~5, '%3C%2Fa%3E'
          7      > RETURN                                                   ~6
          8*     > RETURN                                                   null

End of function replace_at_symbol

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.14 ms | 1386 KiB | 15 Q