3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '/(?:src|href)\=(?:\\\'|")([^\\\'"]+)(?:\\\'|")/'; $source = <<<SRC <a href="http://www.sape.ru">some text</a> <img src='logo.jpg' alt=''></a> SRC; $baseUrl = 'http://www.sape.ru'; $callback = function($matches) use ($baseUrl) { $srcTag = $matches[0]; $url = $matches[1]; $url = str_replace('../', '', $url); $url = str_replace('./', '', $url); $url = str_replace('../', '', $url); }; preg_replace_callback($pattern, $callback, $source);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rZb51
function name:  (null)
number of ops:  12
compiled vars:  !0 = $pattern, !1 = $source, !2 = $baseUrl, !3 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%28%3F%3Asrc%7Chref%29%5C%3D%28%3F%3A%5C%27%7C%22%29%28%5B%5E%5C%27%22%5D%2B%29%28%3F%3A%5C%27%7C%22%29%2F'
    5     1        ASSIGN                                                   !1, '%0A%3Ca+href%3D%22http%3A%2F%2Fwww.sape.ru%22%3Esome+text%3C%2Fa%3E%0A%0A%3Cimg+src%3D%27logo.jpg%27+alt%3D%27%27%3E%3C%2Fa%3E%0A'
   14     2        ASSIGN                                                   !2, 'http%3A%2F%2Fwww.sape.ru'
   16     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FrZb51%3A16%240'
          4        BIND_LEXICAL                                             ~7, !2
          5        ASSIGN                                                   !3, ~7
   30     6        INIT_FCALL                                               'preg_replace_callback'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !3
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FrZb51%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rZb51
function name:  {closure}
number of ops:  25
compiled vars:  !0 = $matches, !1 = $baseUrl, !2 = $srcTag, !3 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   19     2        FETCH_DIM_R                                      ~4      !0, 0
          3        ASSIGN                                                   !2, ~4
   20     4        FETCH_DIM_R                                      ~6      !0, 1
          5        ASSIGN                                                   !3, ~6
   22     6        INIT_FCALL                                               'str_replace'
          7        SEND_VAL                                                 '..%2F'
          8        SEND_VAL                                                 ''
          9        SEND_VAR                                                 !3
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !3, $8
   23    12        INIT_FCALL                                               'str_replace'
         13        SEND_VAL                                                 '.%2F'
         14        SEND_VAL                                                 ''
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $10     
         17        ASSIGN                                                   !3, $10
   24    18        INIT_FCALL                                               'str_replace'
         19        SEND_VAL                                                 '..%2F'
         20        SEND_VAL                                                 ''
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $12     
         23        ASSIGN                                                   !3, $12
   27    24      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FrZb51%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.74 ms | 1400 KiB | 17 Q