<!DOCTYPE html>
<html>
<body>
<?php
function countLetters($matches) {
return $matches[0] . '(' . strlen($matches[0]) . ')';
}
$input = "Welcome to W3Schools.com!";
$pattern = '/[a-z0-9\.]+/i';
$result = preg_replace_callback($pattern, 'countLetters', $input);
echo $result;
?>
</body>
</html>