3v4l.org

run code in 300+ PHP versions simultaneously
<?php //this code will append a &mobileapp to every url ob_start(function($buffer){ $append = 'mobileapp'; $domain = '(?:'.preg_quote('example.com/~hillybilly') .'|'. '(?.*?\.)?'.preg_quote('foobar.com') .')'; $buffer = //str_replace('example.com/~mydir/', 'w00t', $buffer);// preg_replace('/\b(https?:\/\/'.$domain.')([a-z0-9\._\/\~%\-\+&\#!=\(\)@]*)?([?])?([a-z0-9\._\/\~%\-\+&\#!=\(\)@]*)?/im', '$1$2?'.$append.'&$4', $buffer); $regex = '/\b(https?:\/\/'.$domain .'\/?)([a-z0-9\._\/~%\-\+&\#!=\(\)@]*)?([?])?([a-z0-9\._\/~%\-\+&\#!=\(\)@]*)?/igm'; $buffer = preg_replace($regex, '$1$2?'.$append.'&$4', $buffer); return $buffer; }); ?> http://foobar.com http://www.example.com/~hillybilly/foobar.php
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uRUmk
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'ob_start'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FuRUmk%3A3%240'
   14     2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   16     4        ECHO                                                     'http%3A%2F%2Ffoobar.com%0Ahttp%3A%2F%2Fwww.example.com%2F%7Ehillybilly%2Ffoobar.php'
   17     5      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FuRUmk%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uRUmk
function name:  {closure}
number of ops:  28
compiled vars:  !0 = $buffer, !1 = $append, !2 = $domain, !3 = $regex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 'mobileapp'
    5     2        INIT_FCALL                                               'preg_quote'
          3        SEND_VAL                                                 'example.com%2F%7Ehillybilly'
          4        DO_ICALL                                         $5      
          5        CONCAT                                           ~6      '%28%3F%3A', $5
    6     6        CONCAT                                           ~7      ~6, '%7C'
    7     7        CONCAT                                           ~8      ~7, '%28%3F.%2A%3F%5C.%29%3F'
          8        INIT_FCALL                                               'preg_quote'
          9        SEND_VAL                                                 'foobar.com'
         10        DO_ICALL                                         $9      
         11        CONCAT                                           ~10     ~8, $9
    8    12        CONCAT                                           ~11     ~10, '%29'
    5    13        ASSIGN                                                   !2, ~11
   10    14        CONCAT                                           ~13     '%2F%5Cb%28https%3F%3A%5C%2F%5C%2F', !2
   11    15        CONCAT                                           ~14     ~13, '%5C%2F%3F%29%28%5Ba-z0-9%5C._%5C%2F%7E%25%5C-%5C%2B%26%5C%23%21%3D%5C%28%5C%29%40%5D%2A%29%3F%28%5B%3F%5D%29%3F%28%5Ba-z0-9%5C._%5C%2F%7E%25%5C-%5C%2B%26%5C%23%21%3D%5C%28%5C%29%40%5D%2A%29%3F%2Figm'
   10    16        ASSIGN                                           ~15     !3, ~14
    9    17        ASSIGN                                                   !0, ~15
   12    18        INIT_FCALL                                               'preg_replace'
         19        SEND_VAR                                                 !3
         20        CONCAT                                           ~17     '%241%242%3F', !1
         21        CONCAT                                           ~18     ~17, '%26%244'
         22        SEND_VAL                                                 ~18
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $19     
         25        ASSIGN                                                   !0, $19
   13    26      > RETURN                                                   !0
   14    27*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FuRUmk%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.98 ms | 1400 KiB | 19 Q