3v4l.org

run code in 300+ PHP versions simultaneously
<?php $current_url = 'current.sub.meh.com'; $stage_url = 'foo.stage.it'; $current_domains = explode( '.', $current_url ); $current_sub_domain = array_slice( $current_domains, 0, count( $current_domains ) - 2 ); $stage_top_domain = array_slice( explode( '.', $stage_url ), - 2, 2 ); $stage_url = implode( '.', array_merge( $current_sub_domain, $stage_top_domain ) ); echo $stage_url;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FHjmZ
function name:  (null)
number of ops:  36
compiled vars:  !0 = $current_url, !1 = $stage_url, !2 = $current_domains, !3 = $current_sub_domain, !4 = $stage_top_domain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'current.sub.meh.com'
    4     1        ASSIGN                                                   !1, 'foo.stage.it'
    6     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '.'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $7      
          6        ASSIGN                                                   !2, $7
    7     7        INIT_FCALL                                               'array_slice'
          8        SEND_VAR                                                 !2
          9        SEND_VAL                                                 0
         10        COUNT                                            ~9      !2
         11        SUB                                              ~10     ~9, 2
         12        SEND_VAL                                                 ~10
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !3, $11
    8    15        INIT_FCALL                                               'array_slice'
         16        INIT_FCALL                                               'explode'
         17        SEND_VAL                                                 '.'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $13     
         20        SEND_VAR                                                 $13
         21        SEND_VAL                                                 -2
         22        SEND_VAL                                                 2
         23        DO_ICALL                                         $14     
         24        ASSIGN                                                   !4, $14
    9    25        INIT_FCALL                                               'implode'
         26        SEND_VAL                                                 '.'
         27        INIT_FCALL                                               'array_merge'
         28        SEND_VAR                                                 !3
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $16     
         31        SEND_VAR                                                 $16
         32        DO_ICALL                                         $17     
         33        ASSIGN                                                   !1, $17
   11    34        ECHO                                                     !1
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.66 ms | 1396 KiB | 21 Q