1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Files
archived-php-src/ext/mbstring/tests/mb_ereg_replace_callback.phpt
Nikita Popov 39131219e8 Migrate more SKIPIF -> EXTENSIONS (#7139)
This is a mix of more automated and manual migration. It should remove all applicable extension_loaded() checks outside of skipif.inc files.
2021-06-11 12:58:44 +02:00

24 lines
554 B
PHP

--TEST--
mb_ereg_replace_callback()
--EXTENSIONS--
mbstring
--SKIPIF--
<?php
function_exists('mb_ereg_replace_callback') or die("skip mb_ereg_replace_callback() is not available in this build");
?>
--FILE--
<?php
$str = 'abc 123 #",; $foo';
echo mb_ereg_replace_callback('(\S+)', function ($m) {
return $m[1].'('.strlen($m[1]).')';
}, $str), "\n";
echo mb_ereg_replace_callback('(?<word>\w+) (?<digit>\d+).*', function ($m) {
return sprintf("%s-%s", $m['digit'], $m['word']);
}, $str), "\n";
?>
--EXPECT--
abc(3) 123(3) #",;(4) $foo(4)
123-abc