php-src/ext/pcre/tests/preg_replace_callback_array.phpt
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00

49 lines
821 B
PHP

--TEST--
preg_replace_callback_array() basic functions
--FILE--
<?php
class Rep {
public function __invoke() {
return "d";
}
}
class Foo {
public static function rep($rep) {
return "ok";
}
}
function b() {
return "b";
}
var_dump(preg_replace_callback_array(
array(
"/a/" => 'b',
"/b/" => function () { return "c"; },
"/c/" => new Rep,
'/d/' => array("Foo", "rep")), 'a'));
var_dump(preg_replace_callback_array(
array(
"/a/" => 'b',
"/c/" => new Rep,
"/b/" => function () { return "ok"; },
'/d/' => array("Foo", "rep")), 'a'));
var_dump(preg_replace_callback_array(
array(
'/d/' => array("Foo", "rep"),
"/c/" => new Rep,
"/a/" => 'b',
"/b/" => function($a) { return "ok"; }), 'a', -1, $count));
var_dump($count);
?>
--EXPECT--
string(2) "ok"
string(2) "ok"
string(2) "ok"
int(2)