Annotation of embedaddon/php/ext/pcre/tests/preg_replace_callback2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: preg_replace_callback() 2
! 3: --FILE--
! 4: <?php
! 5:
! 6: function f() {
! 7: throw new Exception();
! 8: }
! 9:
! 10: try {
! 11: var_dump(preg_replace_callback('/\w/', 'f', 'z'));
! 12: } catch(Exception $e) {}
! 13:
! 14: function g($x) {
! 15: return "'$x[0]'";
! 16: }
! 17:
! 18: var_dump(preg_replace_callback('@\b\w{1,2}\b@', 'g', array('a b3 bcd', 'v' => 'aksfjk', 12 => 'aa bb')));
! 19:
! 20: var_dump(preg_replace_callback('~\A.~', 'g', array(array('xyz'))));
! 21:
! 22: var_dump(preg_replace_callback('~\A.~', create_function('$m', 'return strtolower($m[0]);'), 'ABC'));
! 23: ?>
! 24: --EXPECTF--
! 25: array(3) {
! 26: [0]=>
! 27: string(12) "'a' 'b3' bcd"
! 28: ["v"]=>
! 29: string(6) "aksfjk"
! 30: [12]=>
! 31: string(9) "'aa' 'bb'"
! 32: }
! 33:
! 34: Notice: Array to string conversion in %spreg_replace_callback2.php on line 17
! 35: array(1) {
! 36: [0]=>
! 37: string(7) "'A'rray"
! 38: }
! 39: string(3) "aBC"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>