3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "my cat is going to the vet"; $ignore = array("my", "is", "to", "the"); $pattern = "~^[a-z]+|\b(?|" . implode("|", $ignore) . ")\b(*SKIP)(*FAIL)|[a-z]+~"; echo "$pattern\n---\n"; echo preg_replace_callback($pattern, function($m) {return ucfirst($m[0]);}, $string);

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
167 ms | 3325 KiB | 13 Q