3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = 'http://domain.test/en/offers/guided-tours/neighbourhoods/academy-traces-of-the-academy-in-antwerp/'; $venueSlug = 'antwerp-city-guided'; echo preg_replace('~(?=/[^/]+/?$)~',"/$venueSlug", $url);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9CM8C
function name:  (null)
number of ops:  11
compiled vars:  !0 = $url, !1 = $venueSlug
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fdomain.test%2Fen%2Foffers%2Fguided-tours%2Fneighbourhoods%2Facademy-traces-of-the-academy-in-antwerp%2F'
    4     1        ASSIGN                                                   !1, 'antwerp-city-guided'
    6     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%7E%28%3F%3D%2F%5B%5E%2F%5D%2B%2F%3F%24%29%7E'
          4        NOP                                                      
          5        FAST_CONCAT                                      ~4      '%2F', !1
          6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $5      
          9        ECHO                                                     $5
         10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.84 ms | 1394 KiB | 15 Q