3v4l.org

run code in 300+ PHP versions simultaneously
<?php function expandShortUrl($shortUrl) { $context = stream_context_create(array( "http" => array( "method" => "HEAD", "follow_location" => 1, "ignore_errors" => 1 ) )); $headers = get_headers($shortUrl, 1, $context); if (isset($headers["Location"])) { return $headers["Location"]; } else { return $shortUrl; } } function expandShortUrls($shortUrls) { $expandedUrls = array(); foreach ($shortUrls as $shortUrl) { $expandedUrl = expandShortUrl($shortUrl); $expandedUrls[] = $expandedUrl; } return $expandedUrls; } // Kısa linkler $shortUrls = array( "https://www.etsy.com/listing/664135699", "https://www.etsy.com/listing/612721265", "https://www.etsy.com/listing/596197569", "https://www.etsy.com/listing/576635976", "https://www.etsy.com/listing/466790858", "https://www.etsy.com/listing/249127718", "https://www.etsy.com/listing/232208668", "https://www.etsy.com/listing/1741336387", "https://www.etsy.com/listing/1680069076", "https://www.etsy.com/listing/1659620413" ); // Kısa linkleri genişlet $expandedUrls = expandShortUrls($shortUrls); // Genişletilmiş linkleri yazdır foreach ($expandedUrls as $index => $expandedUrl) { echo ($index + 1) . ". " . $expandedUrl . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/Vpkt6
function name:  (null)
number of ops:  16
compiled vars:  !0 = $shortUrls, !1 = $expandedUrls, !2 = $expandedUrl, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   ASSIGN                                                   !0, <array>
   43     1        INIT_FCALL                                               'expandshorturls'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $5      
          4        ASSIGN                                                   !1, $5
   46     5      > FE_RESET_R                                       $7      !1, ->14
          6    > > FE_FETCH_R                                       ~8      $7, !2, ->14
          7    >   ASSIGN                                                   !3, ~8
   47     8        ADD                                              ~10     !3, 1
          9        CONCAT                                           ~11     ~10, '.+'
         10        CONCAT                                           ~12     ~11, !2
         11        CONCAT                                           ~13     ~12, '%0A'
         12        ECHO                                                     ~13
   46    13      > JMP                                                      ->6
         14    >   FE_FREE                                                  $7
   48    15      > RETURN                                                   1

Function expandshorturl:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vpkt6
function name:  expandShortUrl
number of ops:  18
compiled vars:  !0 = $shortUrl, !1 = $context, !2 = $headers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'stream_context_create'
    6     2        SEND_VAL                                                 <array>
    4     3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   11     5        INIT_FCALL                                               'get_headers'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 1
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $5      
         10        ASSIGN                                                   !2, $5
   12    11        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'Location'
         12      > JMPZ                                                     ~7, ->16
   13    13    >   FETCH_DIM_R                                      ~8      !2, 'Location'
         14      > RETURN                                                   ~8
   12    15*       JMP                                                      ->17
   15    16    > > RETURN                                                   !0
   17    17*     > RETURN                                                   null

End of function expandshorturl

Function expandshorturls:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/Vpkt6
function name:  expandShortUrls
number of ops:  14
compiled vars:  !0 = $shortUrls, !1 = $expandedUrls, !2 = $shortUrl, !3 = $expandedUrl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ASSIGN                                                   !1, <array>
   21     2      > FE_RESET_R                                       $5      !0, ->11
          3    > > FE_FETCH_R                                               $5, !2, ->11
   22     4    >   INIT_FCALL                                               'expandshorturl'
          5        SEND_VAR                                                 !2
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !3, $6
   23     8        ASSIGN_DIM                                               !1
          9        OP_DATA                                                  !3
   21    10      > JMP                                                      ->3
         11    >   FE_FREE                                                  $5
   25    12      > RETURN                                                   !1
   26    13*     > RETURN                                                   null

End of function expandshorturls

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.68 ms | 1434 KiB | 17 Q