3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pre ="<a href=\""; $post= "</a>"; $in = array('http://">http', 'ftp://">ftp', 'mailto://">mailto', '#">HASH', '//">2xfw slash', '\\\\">2x Bw slash', 'file://">file', 'relative/path">relative/path' ); $replacements = array('/((?:href|src) *= *[\'"](?!(http|ftp|mailto|file|javascript|#|[a-z]+:|\\\\|\/\/)))(\/?)/i' => "$1" . "http://www.server.tld/ABSOLUTE/PATH/" ); foreach($in as $test) { echo "\n". '<<pre>'; $r = $pre . $test . $post; echo "$r \t\t=>\t\t" . preg_replace(array_keys($replacements), $replacements, $r); echo '</pre>'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 24
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/NURnd
function name:  (null)
number of ops:  26
compiled vars:  !0 = $pre, !1 = $post, !2 = $in, !3 = $replacements, !4 = $test, !5 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Ca+href%3D%22'
    3     1        ASSIGN                                                   !1, '%3C%2Fa%3E'
    4     2        ASSIGN                                                   !2, <array>
   13     3        ASSIGN                                                   !3, <array>
   17     4      > FE_RESET_R                                       $10     !2, ->24
          5    > > FE_FETCH_R                                               $10, !4, ->24
   18     6    >   ECHO                                                     '%0A%3C%3Cpre%3E'
   19     7        CONCAT                                           ~11     !0, !4
          8        CONCAT                                           ~12     ~11, !1
          9        ASSIGN                                                   !5, ~12
   20    10        NOP                                                      
         11        FAST_CONCAT                                      ~14     !5, '+%09%09%3D%3E%09%09'
         12        INIT_FCALL                                               'preg_replace'
         13        INIT_FCALL                                               'array_keys'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $15     
         16        SEND_VAR                                                 $15
         17        SEND_VAR                                                 !3
         18        SEND_VAR                                                 !5
         19        DO_ICALL                                         $16     
         20        CONCAT                                           ~17     ~14, $16
         21        ECHO                                                     ~17
   21    22        ECHO                                                     '%3C%2Fpre%3E'
   17    23      > JMP                                                      ->5
         24    >   FE_FREE                                                  $10
   22    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.05 ms | 1395 KiB | 17 Q