3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = "this is the link: https://stackoverflow.com/questions/ask"; $linktext = preg_replace_callback("/([\w]+\:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/", function ($m) { $url = $m[0]; $parts = parse_url($url); $parts["host"] = str_replace("www.", "", $parts["host"]); array_shift($parts); $shortURL = implode("", $parts); $shortenedURL = substr($shortURL, 0, 20); if (strlen($shortURL) > 20) $shortenedURL .= "..."; return "<a href=\"".$url."\">".$shortenedURL."</a>"; var_dump($parts); }, $url); echo $linktext;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mFdPG
function name:  (null)
number of ops:  10
compiled vars:  !0 = $url, !1 = $linktext
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'this+is+the+link%3A+https%3A%2F%2Fstackoverflow.com%2Fquestions%2Fask'
    5     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%28%5B%5Cw%5D%2B%5C%3A%5C%2F%5C%2F%5B%5Cw-%3F%26%3B%23%7E%3D%5C.%5C%2F%5C%40%5D%2B%5B%5Cw%5C%2F%5D%29%2F'
          3        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
   15     4        SEND_VAL                                                 ~3
          5        SEND_VAR                                                 !0
    5     6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   16     8        ECHO                                                     !1
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/mFdPG
function name:  {closure}
number of ops:  42
compiled vars:  !0 = $m, !1 = $url, !2 = $parts, !3 = $shortURL, !4 = $shortenedURL
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        FETCH_DIM_R                                      ~5      !0, 0
          2        ASSIGN                                                   !1, ~5
    7     3        INIT_FCALL                                               'parse_url'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
    8     7        INIT_FCALL                                               'str_replace'
          8        SEND_VAL                                                 'www.'
          9        SEND_VAL                                                 ''
         10        FETCH_DIM_R                                      ~10     !2, 'host'
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                         $11     
         13        ASSIGN_DIM                                               !2, 'host'
         14        OP_DATA                                                  $11
    9    15        INIT_FCALL                                               'array_shift'
         16        SEND_REF                                                 !2
         17        DO_ICALL                                                 
   10    18        INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 ''
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $13     
         22        ASSIGN                                                   !3, $13
   11    23        INIT_FCALL                                               'substr'
         24        SEND_VAR                                                 !3
         25        SEND_VAL                                                 0
         26        SEND_VAL                                                 20
         27        DO_ICALL                                         $15     
         28        ASSIGN                                                   !4, $15
   12    29        STRLEN                                           ~17     !3
         30        IS_SMALLER                                               20, ~17
         31      > JMPZ                                                     ~18, ->33
         32    >   ASSIGN_OP                                     8          !4, '...'
   13    33    >   CONCAT                                           ~20     '%3Ca+href%3D%22', !1
         34        CONCAT                                           ~21     ~20, '%22%3E'
         35        CONCAT                                           ~22     ~21, !4
         36        CONCAT                                           ~23     ~22, '%3C%2Fa%3E'
         37      > RETURN                                                   ~23
   14    38*       INIT_FCALL                                               'var_dump'
         39*       SEND_VAR                                                 !2
         40*       DO_ICALL                                                 
   15    41*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.49 ms | 1017 KiB | 20 Q