I am trying to wrap numbers inside a given string in a <span>.
$datitle = "hey hey 13";
$datitle = preg_replace('/[0-9]/', '<span class="title-number">$1</span>', $datitle);
However that returns:
hey hey <span class="title-number"></span><span class="title-number"></span>
With two empty spans, without the number inside.
What I want to get is:
hey hey <span class="title-number">13</span>
How do I use the number matched by preg_replace as a backreference?