He Ce
He Ce

Reputation: 33

get specific data in array php

i have this array:

Array
(
    [0] => stdClass Object
        (
            [MarketCurrency] => LTC
            [BaseCurrency] => BTC
            [MarketCurrencyLong] => Litecoin
            [BaseCurrencyLong] => Bitcoin
            [MinTradeSize] => 0.03039514
            [MarketName] => BTC-LTC
            [IsActive] => 1
            [IsRestricted] => 
            [Created] => 2014-02-13T00:00:00
            [Notice] => 
            [IsSponsored] => 
            [LogoUrl] => https://bittrexblobstorage.blob.core.windows.net/public/6defbc41-582d-47a6-bb2e-d0fa88663524.png
        )

    [1] => stdClass Object
        (
            [MarketCurrency] => DOGE
            [BaseCurrency] => BTC
            [MarketCurrencyLong] => Dogecoin
            [BaseCurrencyLong] => Bitcoin
            [MinTradeSize] => 462.96296296
            [MarketName] => BTC-DOGE
            [IsActive] => 1
            [IsRestricted] => 
            [Created] => 2014-02-13T00:00:00
            [Notice] => 
            [IsSponsored] => 
            [LogoUrl] => https://bittrexblobstorage.blob.core.windows.net/public/a2b8eaee-2905-4478-a7a0-246f212c64c6.png
        )

}

I would get the "MarketCurrency" data and "BaseCurrency" data. But I don't know how to do.

How can I do this?

I need your help.

Upvotes: 0

Views: 32

Answers (1)

A l w a y s S u n n y
A l w a y s S u n n y

Reputation: 38550

You can do it with simple foreach() to grab the objects.

foreach($data as $obj){
  echo "MarketCurrency = $obj->MarketCurrency and BaseCurrency = $obj->BaseCurrency".PHP_EOL;
}

Upvotes: 1

Related Questions