3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = " apply here https://ph.dbsd.com/job/dfvdfg/5444 and www.google.com also http://somesite.net "; $url_regex = "/\b((https?:\/\/?|www\.)[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|\/)))/"; preg_match_all($url_regex, $str, $matches); foreach($matches[0] as $match){ $anchor = "<a href='$match'>$match</a>"; $str = str_replace($match, $anchor, $str); } echo $str; var_dump($matches);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/TqmkT
function name:  (null)
number of ops:  26
compiled vars:  !0 = $str, !1 = $url_regex, !2 = $matches, !3 = $match, !4 = $anchor
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%0Aapply+here+https%3A%2F%2Fph.dbsd.com%2Fjob%2Fdfvdfg%2F5444%0A%0Aand+www.google.com%0A%0Aalso+http%3A%2F%2Fsomesite.net%0A'
   12     1        ASSIGN                                                       !1, '%2F%5Cb%28%28https%3F%3A%5C%2F%5C%2F%3F%7Cwww%5C.%29%5B%5E%5Cs%28%29%3C%3E%5D%2B%28%3F%3A%5C%28%5B%5Cw%5Cd%5D%2B%5C%29%7C%28%5B%5E%5B%3Apunct%3A%5D%5Cs%5D%7C%5C%2F%29%29%29%2F'
   14     2        INIT_FCALL                                                   'preg_match_all'
          3        SEND_VAR                                                     !1
          4        SEND_VAR                                                     !0
          5        SEND_REF                                                     !2
          6        DO_ICALL                                                     
   16     7        FETCH_DIM_R                                          ~8      !2, 0
          8      > FE_RESET_R                                           $9      ~8, ->20
          9    > > FE_FETCH_R                                                   $9, !3, ->20
   17    10    >   ROPE_INIT                                         5  ~11     '%3Ca+href%3D%27'
         11        ROPE_ADD                                          1  ~11     ~11, !3
         12        ROPE_ADD                                          2  ~11     ~11, '%27%3E'
         13        ROPE_ADD                                          3  ~11     ~11, !3
         14        ROPE_END                                          4  ~10     ~11, '%3C%2Fa%3E'
         15        ASSIGN                                                       !4, ~10
   19    16        FRAMELESS_ICALL_3                str_replace         ~15     !3, !4
         17        OP_DATA                                                      !0
         18        ASSIGN                                                       !0, ~15
   16    19      > JMP                                                          ->9
         20    >   FE_FREE                                                      $9
   22    21        ECHO                                                         !0
   23    22        INIT_FCALL                                                   'var_dump'
         23        SEND_VAR                                                     !2
         24        DO_ICALL                                                     
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.88 ms | 2033 KiB | 15 Q