R
R
RipWay2017-09-23 17:49:12
PHP
RipWay, 2017-09-23 17:49:12

How to wrap numbers in regular expression tag in php?

Greetings. There is a date output in php in the following format:
September 23
Task, wrap numbers in
How to highlight numbers clearly, but how to wrap them in a tag?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
D3lphi, 2017-09-23
@RipWay

$str = '23 сентября';
$result = preg_replace('/([0-9]+)/', '<strong>$1</strong>', $str);

It's not clear which tag you need to wrap the number in, so I used strong as an example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question