3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = "http://jennifer.com/arrest/def/101"; $pattern = '@^(?:http://)?([^/]+)@i'; preg_match($pattern, $subject, $matches); print_r($matches); $url = parse_url("http://www.jennifer.com/user/101/article"); print_r($url); preg_match('/\\\:[a-zA-Z0-9\_\-]+/', "/user/:id/article", $matches); print_r($matches); $pattern = "@^" . preg_replace('/\\\:[a-zA-Z0-9\_\-]+/', '([a-zA-Z0-9\-\_]+)', preg_quote('/user/:id/article')) . "$@D"; $matches = array(); $match = preg_match($pattern, '/users/101/article', $matches); print_r($match); $matches = explode('/', rtrim('/users/101/article', '/')); print_r($matches); $matches = explode('/', rtrim('/users/101/article', "/")); array_shift($matches); print_r($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OHD7h
function name:  (null)
number of ops:  74
compiled vars:  !0 = $subject, !1 = $pattern, !2 = $matches, !3 = $url, !4 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fjennifer.com%2Farrest%2Fdef%2F101'
    4     1        ASSIGN                                                   !1, '%40%5E%28%3F%3Ahttp%3A%2F%2F%29%3F%28%5B%5E%2F%5D%2B%29%40i'
    5     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
    6     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
    7    10        INIT_FCALL                                               'parse_url'
         11        SEND_VAL                                                 'http%3A%2F%2Fwww.jennifer.com%2Fuser%2F101%2Farticle'
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !3, $9
    8    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                                 
    9    17        INIT_FCALL                                               'preg_match'
         18        SEND_VAL                                                 '%2F%5C%5C%3A%5Ba-zA-Z0-9%5C_%5C-%5D%2B%2F'
         19        SEND_VAL                                                 '%2Fuser%2F%3Aid%2Farticle'
         20        SEND_REF                                                 !2
         21        DO_ICALL                                                 
   10    22        INIT_FCALL                                               'print_r'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
   11    25        INIT_FCALL                                               'preg_replace'
         26        SEND_VAL                                                 '%2F%5C%5C%3A%5Ba-zA-Z0-9%5C_%5C-%5D%2B%2F'
         27        SEND_VAL                                                 '%28%5Ba-zA-Z0-9%5C-%5C_%5D%2B%29'
         28        INIT_FCALL                                               'preg_quote'
         29        SEND_VAL                                                 '%2Fuser%2F%3Aid%2Farticle'
         30        DO_ICALL                                         $14     
         31        SEND_VAR                                                 $14
         32        DO_ICALL                                         $15     
         33        CONCAT                                           ~16     '%40%5E', $15
         34        CONCAT                                           ~17     ~16, '%24%40D'
         35        ASSIGN                                                   !1, ~17
   12    36        ASSIGN                                                   !2, <array>
   13    37        INIT_FCALL                                               'preg_match'
         38        SEND_VAR                                                 !1
         39        SEND_VAL                                                 '%2Fusers%2F101%2Farticle'
         40        SEND_REF                                                 !2
         41        DO_ICALL                                         $20     
         42        ASSIGN                                                   !4, $20
   14    43        INIT_FCALL                                               'print_r'
         44        SEND_VAR                                                 !4
         45        DO_ICALL                                                 
   15    46        INIT_FCALL                                               'explode'
         47        SEND_VAL                                                 '%2F'
         48        INIT_FCALL                                               'rtrim'
         49        SEND_VAL                                                 '%2Fusers%2F101%2Farticle'
         50        SEND_VAL                                                 '%2F'
         51        DO_ICALL                                         $23     
         52        SEND_VAR                                                 $23
         53        DO_ICALL                                         $24     
         54        ASSIGN                                                   !2, $24
   16    55        INIT_FCALL                                               'print_r'
         56        SEND_VAR                                                 !2
         57        DO_ICALL                                                 
   17    58        INIT_FCALL                                               'explode'
         59        SEND_VAL                                                 '%2F'
         60        INIT_FCALL                                               'rtrim'
         61        SEND_VAL                                                 '%2Fusers%2F101%2Farticle'
         62        SEND_VAL                                                 '%2F'
         63        DO_ICALL                                         $27     
         64        SEND_VAR                                                 $27
         65        DO_ICALL                                         $28     
         66        ASSIGN                                                   !2, $28
   18    67        INIT_FCALL                                               'array_shift'
         68        SEND_REF                                                 !2
         69        DO_ICALL                                                 
   19    70        INIT_FCALL                                               'print_r'
         71        SEND_VAR                                                 !2
         72        DO_ICALL                                                 
         73      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.01 ms | 1400 KiB | 29 Q