3v4l.org

run code in 300+ PHP versions simultaneously
<?php function countLetters($matches) { return $matches[0] . '(' . strlen($matches[0]) . ')'; } $input = "Welcome to W3Schools.com!"; $pattern = '/[a-z0-9\.]+/i'; $limit = -1; $count = null; $flag = 0; $result = preg_replace_callback($pattern, 'countLetters', $input, $limit, $count, $flag); echo $result;

preferences:
22.93 ms | 404 KiB | 5 Q