3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bb_string = "...du texte [URL]http://developpez.net/[/URL], du texte... [URL]developpez.net/[/URL] du texte... [URL=http://developpez.net/]Un lien[/URL] du texte... [URL=developpez.net/]http://developpez.net/[/URL]"; $bb_string = preg_replace_callback('~\[url (?| = ([^]]*) ] ( [^[]*+ (?:\[(?!/url) [^[]*)*+ ) | ] (( [^[]*+ (?:\[(?!/url) [^[]*)*+ )) ) \[/url]~ix', function ($m) { $url = trim($m[1]); return '<a href="' . ( parse_url($m[1], PHP_URL_SCHEME) ? '' : 'http://') . $m[1] . '" target="_blank">' . trim($m[2]) . '</a>'; }, $bb_string); echo $bb_string;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qcqCL
function name:  (null)
number of ops:  10
compiled vars:  !0 = $bb_string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '...du+texte+%5BURL%5Dhttp%3A%2F%2Fdeveloppez.net%2F%5B%2FURL%5D%2C+du+texte...+%5BURL%5Ddeveloppez.net%2F%5B%2FURL%5D+du+texte...+%5BURL%3Dhttp%3A%2F%2Fdeveloppez.net%2F%5DUn+lien%5B%2FURL%5D+du+texte...+%5BURL%3Ddeveloppez.net%2F%5Dhttp%3A%2F%2Fdeveloppez.net%2F%5B%2FURL%5D'
    5     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7E%5C%5Burl%0A++++%28%3F%7C%0A++++++++%3D+%28%5B%5E%5D%5D%2A%29+%5D+%28+%5B%5E%5B%5D%2A%2B+%28%3F%3A%5C%5B%28%3F%21%2Furl%29+%5B%5E%5B%5D%2A%29%2A%2B+%29%0A++++++%7C%0A++++++++%5D+%28%28+%5B%5E%5B%5D%2A%2B+%28%3F%3A%5C%5B%28%3F%21%2Furl%29+%5B%5E%5B%5D%2A%29%2A%2B+%29%29%0A++++%29%0A++++%5C%5B%2Furl%5D%7Eix'
   11     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   15     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
    5     6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !0, $3
   17     8        ECHO                                                     !0
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qcqCL
function name:  {closure}
number of ops:  27
compiled vars:  !0 = $m, !1 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'trim'
          2        FETCH_DIM_R                                      ~2      !0, 1
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   13     6        INIT_FCALL                                               'parse_url'
          7        FETCH_DIM_R                                      ~5      !0, 1
          8        SEND_VAL                                                 ~5
          9        SEND_VAL                                                 0
         10        DO_ICALL                                         $6      
         11      > JMPZ                                                     $6, ->14
         12    >   QM_ASSIGN                                        ~7      ''
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~7      'http%3A%2F%2F'
         15    >   CONCAT                                           ~8      '%3Ca+href%3D%22', ~7
   14    16        FETCH_DIM_R                                      ~9      !0, 1
         17        CONCAT                                           ~10     ~8, ~9
         18        CONCAT                                           ~11     ~10, '%22+target%3D%22_blank%22%3E'
         19        INIT_FCALL                                               'trim'
         20        FETCH_DIM_R                                      ~12     !0, 2
         21        SEND_VAL                                                 ~12
         22        DO_ICALL                                         $13     
         23        CONCAT                                           ~14     ~11, $13
         24        CONCAT                                           ~15     ~14, '%3C%2Fa%3E'
         25      > RETURN                                                   ~15
   15    26*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.57 ms | 1005 KiB | 16 Q