3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text='this PART should be CONVERTED to uppercase [This PART should not BE changed] this part should also be CONVERTED to uppercase [THIS part should also not be CHANGED] etc..'; $text = preg_replace_callback( "/(\[(.*?)\])(*SKIP)(*FAIL)|./is", function($m) { return strtoupper($m[0]); }, $text); $text = str_replace(array('[', ']'), '', $text); echo $text;
Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
THIS PART SHOULD BE CONVERTED TO UPPERCASE This PART should not BE changed THIS PART SHOULD ALSO BE CONVERTED TO UPPERCASE THIS part should also not be CHANGED ETC..

preferences:
107.19 ms | 1510 KiB | 4 Q