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('/\w.?/', function ($m) { return ucfirst($m[0]); }, $strings));

preferences:
26.39 ms | 406 KiB | 5 Q