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

Output for 5.6.0 - 5.6.10, 5.6.12 - 5.6.14, 5.6.16 - 5.6.28, 5.6.31, 5.6.35 - 5.6.40, 7.0.1 - 7.0.2, 7.0.6 - 7.0.9, 7.0.14 - 7.0.16, 7.0.18 - 7.0.21, 7.0.23, 7.0.25 - 7.1.0, 7.1.3, 7.1.6 - 7.1.17, 7.1.19, 7.1.21 - 7.2.4, 7.2.6 - 7.2.8, 7.2.10 - 7.4.1
23 23
Output for 5.6.11, 5.6.15, 5.6.29 - 5.6.30, 5.6.32 - 5.6.34, 7.0.0, 7.0.3 - 7.0.5, 7.0.10 - 7.0.13, 7.0.17, 7.0.22, 7.0.24, 7.1.1 - 7.1.2, 7.1.4 - 7.1.5, 7.1.18, 7.1.20, 7.2.5, 7.2.9

Process exited with code 137.