3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "[[Some text]] and [[one more here]]"; echo preg_replace_callback("/\[\[(.+?)]]/", function($m) { return '<a href="/XLab/?document=' . str_replace(' ', '_', $m[1]) . '">' . $m[1] . '</a>'; }, $text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AhqgJ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%5BSome+text%5D%5D+and+%5B%5Bone+more+here%5D%5D'
    4     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%5C%5B%5C%5B%28.%2B%3F%29%5D%5D%2F'
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
    6     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
    4     6        DO_ICALL                                         $3      
    6     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/AhqgJ
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 '+'
          3        SEND_VAL                                                 '_'
          4        FETCH_DIM_R                                      ~1      !0, 1
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $2      
          7        CONCAT                                           ~3      '%3Ca+href%3D%22%2FXLab%2F%3Fdocument%3D', $2
          8        CONCAT                                           ~4      ~3, '%22%3E'
          9        FETCH_DIM_R                                      ~5      !0, 1
         10        CONCAT                                           ~6      ~4, ~5
         11        CONCAT                                           ~7      ~6, '%3C%2Fa%3E'
         12      > RETURN                                                   ~7
    6    13*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.24 ms | 955 KiB | 15 Q