- var_dump: documentation ( source)
- preg_replace_callback: documentation ( source)
- strtoupper: documentation ( source)
- preg_replace: documentation ( source)
<?php
$test = "Test -test1";
$match = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', $test);
var_dump($match);
$match = preg_replace_callback('/(?<=^|[\x09\x20\x2D])./', function($matches) {return strtoupper($matches[0]);}, $test);
var_dump($match);