<?php $text = "x человек на сундук x мертвецов";$re = "/x/ui";$result = preg_replace_callback($re, function ($m) { var_dump($m); return '100500';}, $text);var_dump($result);
Standard input is empty
array(1) { [0]=> string(1) "x" } array(1) { [0]=> string(1) "x" } string(65) "100500 человек на сундук 100500 мертвецов"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!