3v4l.org

run code in 300+ PHP versions simultaneously
<?php function autolink($str, $attributes=array()) { $attrs = ''; foreach ($attributes as $attribute => $value) { $attrs .= " {$attribute}=\"{$value}\""; } $str = ' ' . $str; $str = preg_replace( '`([^"=\'>])(((http|https|ftp)://|www.)[^\s<]+[^\s<\.)])`i', '$1<a href="$2"'.$attrs.'>$2</a>', $str ); $str = substr($str, 1); $str = preg_replace('`href=\"www`','href="http://www',$str); // fügt http:// hinzu, wenn nicht vorhanden return $str; } $text="PHP-Infos finden sich auf http://www.php.net und zu preg_replace()auf http://www.php.net/manual/de/function.preg-replace.php"; echo $text; echo "<br>"; echo autolink($text); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9LdkJ
function name:  (null)
number of ops:  8
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, 'PHP-Infos+finden+sich+auf+http%3A%2F%2Fwww.php.net+und+zu+preg_replace%28%29auf+http%3A%2F%2Fwww.php.net%2Fmanual%2Fde%2Ffunction.preg-replace.php'
   21     1        ECHO                                                     !0
   22     2        ECHO                                                     '%3Cbr%3E'
   23     3        INIT_FCALL                                               'autolink'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $2      
          6        ECHO                                                     $2
   26     7      > RETURN                                                   1

Function autolink:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/9LdkJ
function name:  autolink
number of ops:  37
compiled vars:  !0 = $str, !1 = $attributes, !2 = $attrs, !3 = $value, !4 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    3     2        ASSIGN                                                   !2, ''
    4     3      > FE_RESET_R                                       $6      !1, ->13
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->13
          5    >   ASSIGN                                                   !4, ~7
    5     6        ROPE_INIT                                     5  ~10     '+'
          7        ROPE_ADD                                      1  ~10     ~10, !4
          8        ROPE_ADD                                      2  ~10     ~10, '%3D%22'
          9        ROPE_ADD                                      3  ~10     ~10, !3
         10        ROPE_END                                      4  ~9      ~10, '%22'
         11        ASSIGN_OP                                     8          !2, ~9
    4    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $6
    7    14        CONCAT                                           ~14     '+', !0
         15        ASSIGN                                                   !0, ~14
    8    16        INIT_FCALL                                               'preg_replace'
    9    17        SEND_VAL                                                 '%60%28%5B%5E%22%3D%27%3E%5D%29%28%28%28http%7Chttps%7Cftp%29%3A%2F%2F%7Cwww.%29%5B%5E%5Cs%3C%5D%2B%5B%5E%5Cs%3C%5C.%29%5D%29%60i'
   10    18        CONCAT                                           ~16     '%241%3Ca+href%3D%22%242%22', !2
         19        CONCAT                                           ~17     ~16, '%3E%242%3C%2Fa%3E'
         20        SEND_VAL                                                 ~17
   11    21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $18     
    8    23        ASSIGN                                                   !0, $18
   13    24        INIT_FCALL                                               'substr'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $20     
         28        ASSIGN                                                   !0, $20
   14    29        INIT_FCALL                                               'preg_replace'
         30        SEND_VAL                                                 '%60href%3D%5C%22www%60'
         31        SEND_VAL                                                 'href%3D%22http%3A%2F%2Fwww'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $22     
         34        ASSIGN                                                   !0, $22
   16    35      > RETURN                                                   !0
   17    36*     > RETURN                                                   null

End of function autolink

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159 ms | 1403 KiB | 18 Q