Run ❯
Get your
own PHP
server
Result Size:
625 x 565
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
<!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>
Welcome(7) to(2) W3Schools.com(13)!