Treating array with php to Laravel

Asked

Viewed 56 times

0

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

I need to recover 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"
}

}

1 answer

0

It’s very simple friend, just you select the items this way:

$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 English documentation of the array here:

https://secure.php.net/manual/en/language.types.array.php

Look at what you will do with the Coinpayments api on!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.