3v4l.org

run code in 200+ PHP versions simultaneously
<?php $main_string = "23/CSE/4/2014"; $sub_string = "CSE/4/2014"; echo 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 BlrV6
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZETgL
function name:  (null)
number of ops:  22
compiled vars:  !0 = $main_string, !1 = $sub_string
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   QM_ASSIGN                                                !0
   3     1        QM_ASSIGN                                                !1
   5     2        INIT_FCALL                                               'str_replace'
         3        SEND_VAR                                                 !1
         4        SEND_VAL                                                 ''
         5        SEND_VAR                                                 !0
         6        DO_ICALL                                         $4      
         7        ASSIGN_OBJ                                               $4
   6     8        ASSIGN_OBJ                                               '%0A'
   8     9        QM_ASSIGN                                                !0
   9    10        QM_ASSIGN                                                !1
  11    11        INIT_FCALL                                               'trim'
        12        INIT_FCALL                                               'str_replace'
        13        SEND_VAR                                                 !1
        14        SEND_VAL                                                 ''
        15        SEND_VAR                                                 !0
        16        DO_ICALL                                         $7      
        17        SEND_VAR                                                 $7
        18        SEND_VAL                                                 '%2F'
        19        DO_ICALL                                         $8      
        20        ASSIGN_OBJ                                               $8
        21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.4.0