3v4l.org

run code in 500+ 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 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/mFdPG
function name:  {closure:/in/mFdPG:5}
number of ops:  33
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        FETCH_DIM_R                                          ~10     !2, 'host'
          8        FRAMELESS_ICALL_3                str_replace         ~11     'www.', ''
          9        OP_DATA                                                      ~10
         10        ASSIGN_DIM                                                   !2, 'host'
         11        OP_DATA                                                      ~11
    9    12        INIT_FCALL                                                   'array_shift'
         13        SEND_REF                                                     !2
         14        DO_ICALL                                                     
   10    15        FRAMELESS_ICALL_2                implode             ~13     '', !2
         16        ASSIGN                                                       !3, ~13
   11    17        FRAMELESS_ICALL_3                substr              ~15     !3, 0
         18        OP_DATA                                                      20
         19        ASSIGN                                                       !4, ~15
   12    20        STRLEN                                               ~17     !3
         21        IS_SMALLER                                                   20, ~17
         22      > JMPZ                                                         ~18, ->24
         23    >   ASSIGN_OP                                         8          !4, '...'
   13    24    >   CONCAT                                               ~20     '%3Ca+href%3D%22', !1
         25        CONCAT                                               ~21     ~20, '%22%3E'
         26        CONCAT                                               ~22     ~21, !4
         27        CONCAT                                               ~23     ~22, '%3C%2Fa%3E'
         28      > RETURN                                                       ~23
   14    29*       INIT_FCALL                                                   'var_dump'
         30*       SEND_VAR                                                     !2
         31*       DO_ICALL                                                     
   15    32*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
178.4 ms | 2252 KiB | 17 Q