1--TEST-- 2preg_replace_callback_array() basic functions 3--FILE-- 4<?php 5 6class Rep { 7 public function __invoke() { 8 return "d"; 9 } 10} 11 12class Foo { 13 public static function rep($rep) { 14 return "ok"; 15 } 16} 17 18function b() { 19 return "b"; 20} 21 22var_dump(preg_replace_callback_array( 23 array( 24 "/a/" => 'b', 25 "/b/" => function () { return "c"; }, 26 "/c/" => new Rep, 27 '/d/' => array("Foo", "rep")), 'a')); 28 29var_dump(preg_replace_callback_array( 30 array( 31 "/a/" => 'b', 32 "/c/" => new Rep, 33 "/b/" => function () { return "ok"; }, 34 '/d/' => array("Foo", "rep")), 'a')); 35 36var_dump(preg_replace_callback_array( 37 array( 38 '/d/' => array("Foo", "rep"), 39 "/c/" => new Rep, 40 "/a/" => 'b', 41 "/b/" => create_function('$a', 'return "ok";')), 'a', -1, $count)); 42 43var_dump($count); 44?> 45--EXPECTF-- 46string(2) "ok" 47string(2) "ok" 48string(2) "ok" 49int(2) 50