我試圖用2個解碼的html字符替換一個十進制數。我知道我需要使用正則表達式,但無法正確寫入。 我的字符串:Php正則表達式更改特殊字符之間的十進制數
$string = 'class="total">5.00</td>';
我需要改變的是5.00與其他的十進制數。
我已經試過了:
$string = 'class="total">5.00</td>';
$new_number = 7.00;
echo preg_replace('#\class="total">(.+?)\</td>#', $new_number, $string);