3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'https://www.example.com#anchor'; $host = parse_url($url, PHP_URL_HOST); // www.example.com /* preg_match('/(\w+)\.(\w+)$/', $host, $matches); $array_result = array ( "name" => $matches[1], "tld" => $matches[2] ); */ $host_names = explode(".", $host); $array_result = array ( "name" => $host_names[count($host_names)-2], "tld" => $host_names[count($host_names)-1] ); print_r($array_result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XFThK
function name:  (null)
number of ops:  24
compiled vars:  !0 = $url, !1 = $host, !2 = $host_names, !3 = $array_result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'https%3A%2F%2Fwww.example.com%23anchor'
    4     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 1
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   12     6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '.'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
   13    11        COUNT                                            ~9      !2
         12        SUB                                              ~10     ~9, 2
         13        FETCH_DIM_R                                      ~11     !2, ~10
         14        INIT_ARRAY                                       ~12     ~11, 'name'
   14    15        COUNT                                            ~13     !2
         16        SUB                                              ~14     ~13, 1
         17        FETCH_DIM_R                                      ~15     !2, ~14
         18        ADD_ARRAY_ELEMENT                                ~12     ~15, 'tld'
   13    19        ASSIGN                                                   !3, ~12
   16    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.09 ms | 1012 KiB | 16 Q