E
E
Extramezz2015-09-26 11:03:21
PHP
Extramezz, 2015-09-26 11:03:21

How to use function in preg_replace?

In general, there is this code:
preg_replace("/тут неважно что/", "$1$2", str);
Regular return 2 brackets, how can I do something like this:

preg_replace("/тут неважно что/", my_func($1, $2), str);

That is, pass them to the function, and preg_replace to accept the result of its call.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin, 2015-09-26
@Extramezz

preg_replace_callback ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question