Treating array with php for laravel

0

I need to retrieve the first array from this list of arrays.

I need to retrieve BTC and LTC, and the attributes rate_btc, tx_fee and name.

array(1029) {
  ["BTC"]=>
  array(9) {
["is_fiat"]=>
int(0)
["rate_btc"]=>
string(26) "1.000000000000000000000000"
["last_update"]=>
string(10) "1375473661"
["tx_fee"]=>
string(10) "0.00040000"
["status"]=>
string(6) "online"
["name"]=>
string(7) "Bitcoin"
["confirms"]=>
string(1) "2"
["can_convert"]=>
int(1)
["capabilities"]=>
array(4) {
  [0]=>
  string(8) "payments"
  [1]=>
  string(6) "wallet"
  [2]=>
  string(9) "transfers"
  [3]=>
  string(7) "convert"
} 
}
["LTC"]=>
  array(9) {
["is_fiat"]=>
int(0)
["rate_btc"]=>
string(26) "0.008875105000000000000000"
["last_update"]=>
string(10) "1538787360"
["tx_fee"]=>
string(10) "0.00200000"
["status"]=>
string(6) "online"
["name"]=>
string(8) "Litecoin"
["confirms"]=>
string(1) "3"
["can_convert"]=>
int(1)
["capabilities"]=>
array(4) {
  [0]=>
  string(8) "payments"
  [1]=>
  string(6) "wallet"
  [2]=>
  string(9) "transfers"
  [3]=>
  string(7) "convert"
}

}

    
asked by anonymous 06.10.2018 / 13:53

1 answer

0

It's quite simple, just select the items like this:

$btc_rate_btc = $array['BTC']['rate_btc'];
$btc_tx_fee = $array['BTC']['tx_fee'];
$btc_name = $array['BTC']['name'];

$ltc_rate_btc = $array['LTC']['rate_btc'];
$ltc_tx_fee = $array['LTC']['tx_fee'];
$ltc_name = $array['LTC']['name'];

You can take a look at the Portuguese documentation for the array here:

link

Look what you will do with the api of Coinpayments in!

    
08.10.2018 / 03:25