主页
PHP
PHP preg_replace_callback() 函数
tryphp_func_regex_preg_replace_callback
运行 ❯
×
更改方向
保存代码
更改主题
<?php function countLetters($matches) { return $matches[0] . '(' . strlen($matches[0]) . ')'; } $input = "Welcome to freew3c.com!"; $pattern = '/[a-z0-9\.]+/i'; $result = preg_replace_callback($pattern, 'countLetters', $input); echo $result; ?>