A
A
Artyom Sysolyatin2015-10-15 22:39:11
PHP
Artyom Sysolyatin, 2015-10-15 22:39:11

How to make a change to php?

The $text variable contains the text, among which there is a link like this [id1|Pavel Durov].
How can I change it to

<a href="http://vk.com/id1" target="_blank">Павел Дуров</a>

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2015-10-15
@pingvi69

ideone.com/6DmkTY

S
Sergey, 2015-10-15
@gangstarcj

php.net/manual/en/function.explode.php
php.net/manual/en/function.substr.php Explode
by "|", cut "[", "]" before that

X
xmoonlight, 2015-10-15
@xmoonlight

This task...
PS: is done by string and/or regular expression functions.
Google...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question