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() var_export(preg_replace_callback('/(^|.)\K\w/', function($m) {return strtoupper($m[0]); }, $strings));

preferences:
179.1 ms | 406 KiB | 5 Q