1--TEST--
2mb_ereg_replace_callback()
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip mbstring not available');
6function_exists('mb_ereg_replace_callback') or die("skip mb_ereg_replace_callback() is not available in this build");
7?>
8--FILE--
9<?php
10$str = 'abc 123 #",; $foo';
11
12echo mb_ereg_replace_callback('(\S+)', function ($m) {
13    return $m[1].'('.strlen($m[1]).')';
14}, $str), "\n";
15
16echo mb_ereg_replace_callback('(?<word>\w+) (?<digit>\d+).*', function ($m) {
17    return sprintf("%s-%s", $m['digit'], $m['word']);
18}, $str), "\n";
19?>
20--EXPECT--
21abc(3) 123(3) #",;(4) $foo(4)
22123-abc
23