如何在PHP中拆分此类字符串并获取特定值

如何在PHP中拆分此类字符串并获取特定值,php,Php,我有一根这样的绳子 {"Account":{"Currency":"SGD","CreditLimit":0.0000,"Balance":1649.5700},"Status":36,"Code":891,"Message":"Success"}- 我需要平衡的价值 我试过了 $string = '{"Account":{"Currency":"SGD","CreditLimit":0.0000,"Balance":1649.5700},"Status":1,"Code":1,"Messag

我有一根这样的绳子

{"Account":{"Currency":"SGD","CreditLimit":0.0000,"Balance":1649.5700},"Status":36,"Code":891,"Message":"Success"}-
我需要平衡的价值

我试过了

$string = '{"Account":{"Currency":"SGD","CreditLimit":0.0000,"Balance":1649.5700},"Status":1,"Code":1,"Message":"Success"}-';
$withCharacter = strstr($string, 'Balance":');
echo substr($withCharacter, 1); 

也尝试使用explode,但没有成功。

这似乎是一个有效的JSON,为什么不
JSON\u解码
并找到值:

$i = json_decode('{"Account":{"Currency":"SGD","CreditLimit":0.0000,"Balance":1649.5700},"Status":36,"Code":891,"Message":"Success"}');
echo $i->Account->Balance;

余额值可能会一直变化,除了最后的
-
,这似乎是有效的JSON。因此,请将其从末尾删除,然后使用
json\u decode