PHP money格式在不同的服务器上返回带/不带货币前缀的字符串

My client has 2 servers, staging and live. They have different PHP versions (I know - they provide them that way). I have this code:

setlocale(LC_MONETARY, 'en_GB');
$product = wc_get_product( $product_id );
if ($product->get_price()){
   return (string) money_format('%i', $product->get_price());
}

On the staging server it returns prices formatted like this: 'GBP 10.00' However on live it returns prices without the GBP prefix, just '10.00'

On both servers when run: locale -a | grep en_GB I get:

en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8

Staging server is running PHP 5.6.21 on Linux version 2.6.32-696.18.7.el6.x86_64 (mockbuild@c1bl.rdu2.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP Thu Jan 4 17:31:22 UTC 2018

Live is running PHP 5.3.28 on Linux version 4.9.96mtv23 (ci_slave@cislave73-git.mtsvc.net) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Tue May 15 14:22:40 PDT 2018

Additional discovery... I've now found that the issue occurs when this code is called many times from a loop (i.e. when I am returning a lot of products). If it is just called once during the execution of the php script (returning a single product) it works!

You should set locale with utf-8 charset:

setlocale(LC_MONETARY, 'en_GB.utf8');