You haven't offered any details into the variability of your input strings, so we can only assume the challenges that you may be facing.
If your sub_string is always on the right side of the value that you wish to isolate, then this will do:
$main_string = "23/CSE/4/2014";
$sub_string = "/CSE/4/2014";
echo str_replace($sub_string, '', $main_string);
If the value to be isolated may exist on either side of the sub_string, then this will do the job:
$main_string = "23/CSE/4/2014"; // or "CSE/4/2014/23"
$sub_string = "CSE/4/2014"; // notice no leading/trailing slash on this value
echo trim(str_replace($sub_string, '', $main_string), '/'); // leading/trailing slashes are trimmed
If the value to be isolated may be nested inside of the substring's slash delimited values, then you have a more complicated challenge to contend with and a rethink about data formatting may be in order.
Exploding your main_string and sub_string then making iterated comparisons (or an
array_diff() call) to filter the individual values is going to be heavy-handed and/or potentially damaging. If the desired value is the same as one of the sub_string slash-delimited values, you will lose what you are trying to find.
p.s. Since this question is tagged with
mysql for some reason, I'll offer the MySQL equivalent of my first snippet:
SELECT REPLACE('23/CSE/4/2014', '/CSE/4/2014', '')