3v4l.org

run code in 200+ PHP versions simultaneously
<?php $main_string = "23/CSE/4/2014"; $sub_string = "CSE/4/2014"; echo trim(str_replace($sub_string, '', $main_string), '/'); echo "\n"; $main_string = "CSE/4/2014/23"; $sub_string = "CSE/4/2014"; echo trim(str_replace($sub_string, '', $main_string), '/');
based on ZETgL

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QiJss
function name:  (null)
number of ops:  26
compiled vars:  !0 = $main_string, !1 = $sub_string
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   ASSIGN                                                   !0, '23%2FCSE%2F4%2F2014'
   3     1        ASSIGN                                                   !1, 'CSE%2F4%2F2014'
   5     2        INIT_FCALL                                               'trim'
         3        INIT_FCALL                                               'str_replace'
         4        SEND_VAR                                                 !1
         5        SEND_VAL                                                 ''
         6        SEND_VAR                                                 !0
         7        DO_ICALL                                         $4      
         8        SEND_VAR                                                 $4
         9        SEND_VAL                                                 '%2F'
        10        DO_ICALL                                         $5      
        11        ECHO                                                     $5
   7    12        ECHO                                                     '%0A'
   9    13        ASSIGN                                                   !0, 'CSE%2F4%2F2014%2F23'
  10    14        ASSIGN                                                   !1, 'CSE%2F4%2F2014'
  12    15        INIT_FCALL                                               'trim'
        16        INIT_FCALL                                               'str_replace'
        17        SEND_VAR                                                 !1
        18        SEND_VAL                                                 ''
        19        SEND_VAR                                                 !0
        20        DO_ICALL                                         $8      
        21        SEND_VAR                                                 $8
        22        SEND_VAL                                                 '%2F'
        23        DO_ICALL                                         $9      
        24        ECHO                                                     $9
        25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.4.0