How to display only one value from the array?

I'm a novice. Is the php code:
require_once 'Qiwi.php';
$qiwi = new Qiwi('*************', '*************************************');
$balance = $qiwi->getBalance();
echo '<pre>';
print_r($balance);
echo '</pre>';

The result code is an array:
Array
(
 [accounts] => Array
(
 [0] => Array
(
 [alias] => qw_wallet_rub
 [fsAlias] => qb_wallet
 [bankAlias] => QIWI
 [title] => WALLET
 [type] => Array
(
 [id] => WALLET
 [title] => Visa QIWI Wallet
)

 [hasBalance] => 1
 [balance] => Array
(
 [amount] => 12314.61
 [currency] => 643
)

 [currency] => 643
 [defaultAccount] => 1
)

)

)

I need at the end of the execute code is displayed not the whole array, but only [amount] => 100.00. Tell me, and I did not realize)
March 19th 20 at 09:01
3 answers
March 19th 20 at 09:03
Solution
echo $balance['accounts'][0]['balance']['amount']
Thank you! - claudie commented on March 19th 20 at 09:06
March 19th 20 at 09:05
if(!empty($balance['accounts'][0]['hasBalance'])){
echo $balance['accounts'][0]['balance']['amount'];
}
Thank you! - claudie commented on March 19th 20 at 09:08
March 19th 20 at 09:07
Thank you! - claudie commented on March 19th 20 at 09:10

Find more questions by tags PHP