3v4l.org

run code in 300+ 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), '/');
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.0.33, 7.1.0, 7.1.3, 7.1.6 - 7.1.17, 7.1.19, 7.1.21 - 7.1.33, 7.2.0 - 7.2.4, 7.2.6 - 7.2.8, 7.2.10 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1, 8.1.24 - 8.1.28, 8.2.11 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
23 23
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 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.

preferences:
143.25 ms | 404 KiB | 177 Q