3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "test string", "lado lomidze needs a solution", "i made some research and found 'good' answers here; they really helped me." ]; // if not already all lowercase, use strtolower() foreach ($strings as &$string) { for ($i = 0, $len = strlen($string); $i < $len; $i += 2) { $string[$i] = strtoupper($string[$i]); } } var_export($strings);

preferences:
24.97 ms | 405 KiB | 5 Q