3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "<p>Some string www.test.com with urls http://test.com in it http://www.test.com.</p>"; if(preg_match_all("/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/",$text,$urls)){ foreach($urls[0]as $url ){ $text = str_replace($url,'<a href="'.$url.'">'.$url.'</a>',$text); } } echo $text;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 22
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 21
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 22
filename:       /in/VRXuf
function name:  (null)
number of ops:  24
compiled vars:  !0 = $text, !1 = $urls, !2 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp%3ESome+string+www.test.com+with+urls+http%3A%2F%2Ftest.com+in+it+http%3A%2F%2Fwww.test.com.%3C%2Fp%3E'
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28%28http%7Chttps%29%5C%3A%5C%2F%5C%2F%29%3F%5Ba-zA-Z0-9%5C.%5C%2F%5C%3F%5C%3A%40%5C-_%3D%23%5D%2B%5C.%28%5Ba-zA-Z0-9%5C%26%5C.%5C%2F%5C%3F%5C%3A%40%5C-_%3D%23%5D%29%2A%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $4      
          6      > JMPZ                                                     $4, ->22
    6     7    >   FETCH_DIM_R                                      ~5      !1, 0
          8      > FE_RESET_R                                       $6      ~5, ->21
          9    > > FE_FETCH_R                                               $6, !2, ->21
    7    10    >   INIT_FCALL                                               'str_replace'
         11        SEND_VAR                                                 !2
         12        CONCAT                                           ~7      '%3Ca+href%3D%22', !2
         13        CONCAT                                           ~8      ~7, '%22%3E'
         14        CONCAT                                           ~9      ~8, !2
         15        CONCAT                                           ~10     ~9, '%3C%2Fa%3E'
         16        SEND_VAL                                                 ~10
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !0, $11
    6    20      > JMP                                                      ->9
         21    >   FE_FREE                                                  $6
   11    22    >   ECHO                                                     !0
   12    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.97 ms | 1396 KiB | 17 Q