Parse currency from string

前端 未结 5 1547
无人及你
无人及你 2021-01-02 18:25

I want to parse a currency from a string in PHP, I\'ve had a look at number formatter but haven\'t got PHP 5.3 or the ability to add extensions.

The currency will on

5条回答
  •  无人及你
    2021-01-02 19:25

    You could do it with a regular expression ($matches[1] will have your value):

    preg_match('/£([0-9]+|[0-9]+\.?[0-9]{2})/', $text, $matches);
    

提交回复
热议问题