3v4l.org

run code in 300+ PHP versions simultaneously
<?php //this code will append a &mobileapp to every https://example.com url and http://foobar.com url ob_start(function($buffer){ $append = 'mobileapp'; $domain = '(?:'.preg_quote('example.com/~hillybilly', '/') .'|'. '(?.*?\.)?'.preg_quote('foobar.com', '/') .')'; $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 silly silly ob_end_flush();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/df5eM
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%2Fdf5eM%3A3%240'
   18     2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   20     4        ECHO                                                     'http%3A%2F%2Ffoobar.com%0Ahttp%3A%2F%2Fwww.example.com%2F%7Ehillybilly%2Ffoobar.php%0Asilly+silly%0Aob_end_flush%28%29%3B'
   23     5      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fdf5eM%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/df5eM
function name:  {closure}
number of ops:  29
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'
    6     2        INIT_FCALL                                               'preg_quote'
          3        SEND_VAL                                                 'example.com%2F%7Ehillybilly'
          4        SEND_VAL                                                 '%2F'
          5        DO_ICALL                                         $5      
          6        CONCAT                                           ~6      '%28%3F%3A', $5
    7     7        CONCAT                                           ~7      ~6, '%7C'
    8     8        CONCAT                                           ~8      ~7, '%28%3F.%2A%3F%5C.%29%3F'
          9        INIT_FCALL                                               'preg_quote'
         10        SEND_VAL                                                 'foobar.com'
         11        SEND_VAL                                                 '%2F'
         12        DO_ICALL                                         $9      
         13        CONCAT                                           ~10     ~8, $9
    9    14        CONCAT                                           ~11     ~10, '%29'
    6    15        ASSIGN                                                   !2, ~11
   12    16        CONCAT                                           ~13     '%2F%5Cb%28https%3F%3A%5C%2F%5C%2F', !2
   13    17        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'
   12    18        ASSIGN                                                   !3, ~14
   15    19        INIT_FCALL                                               'preg_replace'
         20        SEND_VAR                                                 !3
         21        CONCAT                                           ~16     '%241%242%3F', !1
         22        CONCAT                                           ~17     ~16, '%26%244'
         23        SEND_VAL                                                 ~17
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $18     
         26        ASSIGN                                                   !0, $18
   17    27      > RETURN                                                   !0
   18    28*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.46 ms | 1392 KiB | 19 Q