[Solved] Move Pound £ symbol from after a number to before it


This should work:

<?php
$re="/(\d{1,})/m";
$str="<b>100£</b> was £160";

preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
if(count($matches)>0 && isset($matches[0][0]) && isset($matches[1][0])) {
    echo(sprintf('<b>£%d</b> was £%d', $matches[0][0], $matches[1][0]));
}

0

solved Move Pound £ symbol from after a number to before it