M
M
MDLES2018-03-28 14:22:26
PHP
MDLES, 2018-03-28 14:22:26

How to write function replace_text?

Good afternoon.
I need help, there is a site - zhidkov-art.com/portfolio-item/artem-angelina/
I need to create a function replace_text to replace links (starting with fex.net/get/…) that I post in posts, automatically chained to 5abb806f247f8531334576.png
me thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gerasimov, 2018-03-28
@mrTeo

function replace_text($text) {
    return preg_replace('/\s?(fex\.net\/get\/.*?)(\s|$)/', '<img src="//$1" alt="">', $text);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question