3v4l.org

run code in 300+ PHP versions simultaneously
<?php $body = "Text text #hashtag text text #hast/tag"; $hashtag_path = '/path/to'; $hashtags_url = '/#(\S+)/'; $body = preg_replace_callback( $hashtags_url, function($matches) use ($hashtag_path) { return "<a href=\"$hashtag_path/hashtag/".urlencode($matches[1])."\">".$matches[0]."</a>"; }, $body); echo $body;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NDTsu
function name:  (null)
number of ops:  13
compiled vars:  !0 = $body, !1 = $hashtag_path, !2 = $hashtags_url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Text+text+%23hashtag+text+text+%23hast%2Ftag'
    4     1        ASSIGN                                                   !1, '%2Fpath%2Fto'
    5     2        ASSIGN                                                   !2, '%2F%23%28%5CS%2B%29%2F'
    6     3        INIT_FCALL                                               'preg_replace_callback'
    7     4        SEND_VAR                                                 !2
          5        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          6        BIND_LEXICAL                                             ~6, !1
    9     7        SEND_VAL                                                 ~6
   10     8        SEND_VAR                                                 !0
    6     9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !0, $7
   11    11        ECHO                                                     !0
   12    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/NDTsu
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $matches, !1 = $hashtag_path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    8     2        ROPE_INIT                                     3  ~3      '%3Ca+href%3D%22'
          3        ROPE_ADD                                      1  ~3      ~3, !1
          4        ROPE_END                                      2  ~2      ~3, '%2Fhashtag%2F'
          5        INIT_FCALL                                               'urlencode'
          6        FETCH_DIM_R                                      ~5      !0, 1
          7        SEND_VAL                                                 ~5
          8        DO_ICALL                                         $6      
          9        CONCAT                                           ~7      ~2, $6
         10        CONCAT                                           ~8      ~7, '%22%3E'
         11        FETCH_DIM_R                                      ~9      !0, 0
         12        CONCAT                                           ~10     ~8, ~9
         13        CONCAT                                           ~11     ~10, '%3C%2Fa%3E'
         14      > RETURN                                                   ~11
    9    15*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
286.71 ms | 1012 KiB | 15 Q