我有两个数量,如10-250
我想要显示每英镑(磅)符号,并给出hyphen
和amount
之间的每一个space
它看起来像£10 - £250
请建议我有任何正则表达式在那里添加£在每个价格量。如何在每个价格之前在PHP中添加英镑(磅)?
ex : -
1-10 = £1 - £10
10-20-30 = £10 - £20 -£30
500-600-800 = £500 - £600 - £800
编辑:
Code:
//$priceStr = urldecode($this->params['named']['price']);
$priceStr = '10-250';
$getExplodePrice = explode('-',$priceStr);
foreach($getExplodePrice as $newPrice){
$price[] = '£'.$newPrice.' -';
}
echo implode(' ',$price);
您是否尝试过的东西?还是做了一些研究? – Rizier123 2015-03-19 13:16:29
我已经尝试过,但没有得到任何解决方案。 :( – Developer 2015-03-19 13:17:31
包括你的尝试,然后 – Epodax 2015-03-19 13:18:13