在php中获取数组值

This is the array i want to mc_gross value. please help

Array
(
    [id] => 5
    [txn_id] => 1fadfa1sfsa2
    [log] => Array
(
    [mc_gross] => 298.44
    [invoice] => 0856545471323
    [protection_eligibility] => Eligible
    [address_status] => confirmed
    [item_number1] => 12299
    [payer_id] => UTU3f7TLQ6DLX4
    [tax] => 0.00
    [address_street] => 1 Main St
    [payment_date] => 02:10:29 May 28, 2015 PDT
    [payment_status] => Completed
    [charset] => windows-1252
    [address_zip] => 95131
    [mc_shipping] => 0.00
    [mc_handling] => 0.00
    [first_name] =>Rohit
    [mc_fee] => 8.95
    [address_country_code] => US
    [address_name] => Rohit
    [notify_version] => 3.8
    [custom] => 
    [payer_status] => verified
    [business] => sunny@gmail.com
    [address_country] => United States
    [num_cart_items] => 1
    [mc_handling1] => 0.00
    [address_city] => San Jose
    [verify_sign] => AHr7LP.QXtufNfq97cbEdHHkqfNkJAtdXVkTwL.GBwGZwJBQ5GAJaqaXx
    [payer_email] => rohit@hotmail.com
    [mc_shipping1] => 0.00
    [tax1] => 0.00
    [txn_id] => 1FV62057CK3146235
    [payment_type] => instant
    [last_name] => Vishwakarma
    [address_state] => CA
    [item_name1] => Centro Yas Island Rotana - Demo
    [receiver_email] => sunny@gmail.com
    [payment_fee] => 8.95
    [quantity1] => 1
    [receiver_id] => 6Y6GRJS8NA8JE
    [txn_type] => cart
    [mc_gross_1] => 298.44
    [mc_currency] => USD
    [residence_country] => US
    [test_ipn] => 1
    [transaction_subject] => 
    [payment_gross] => 298.44
    [ipn_track_id] => 8656eb7f3009dd4
)

    [posted_date] => 2015-05-28 09:10:34
)
$VARIABLE_NAME['log']['mc_gross']

you can output it as:

echo $VARIABLE_NAME['log']['mc_gross'];

Try like this

echo $array_name["log"]["mc_gross"];

You can simply get it as

echo $array_name['log']['mc_gross'];
$arr= Array
(
    [id] => 5
    [txn_id] => 1fadfa1sfsa2
    [log] => Array
(
    [mc_gross] => 298.44
    [invoice] => 0856545471323
    [protection_eligibility] => Eligible
    [address_status] => confirmed
    [item_number1] => 12299
    [payer_id] => UTU3f7TLQ6DLX4
    [tax] => 0.00
    [address_street] => 1 Main St
    [payment_date] => 02:10:29 May 28, 2015 PDT
    [payment_status] => Completed
    [charset] => windows-1252
    [address_zip] => 95131
    [mc_shipping] => 0.00
    [mc_handling] => 0.00
    [first_name] =>Rohit
    [mc_fee] => 8.95
    [address_country_code] => US
    [address_name] => Rohit
    [notify_version] => 3.8
    [custom] => 
    [payer_status] => verified
    [business] => sunny@gmail.com
    [address_country] => United States
    [num_cart_items] => 1
    [mc_handling1] => 0.00
    [address_city] => San Jose
    [verify_sign] => AHr7LP.QXtufNfq97cbEdHHkqfNkJAtdXVkTwL.GBwGZwJBQ5GAJaqaXx
    [payer_email] => rohit@hotmail.com
    [mc_shipping1] => 0.00
    [tax1] => 0.00
    [txn_id] => 1FV62057CK3146235
    [payment_type] => instant
    [last_name] => Vishwakarma
    [address_state] => CA
    [item_name1] => Centro Yas Island Rotana - Demo
    [receiver_email] => sunny@gmail.com
    [payment_fee] => 8.95
    [quantity1] => 1
    [receiver_id] => 6Y6GRJS8NA8JE
    [txn_type] => cart
    [mc_gross_1] => 298.44
    [mc_currency] => USD
    [residence_country] => US
    [test_ipn] => 1
    [transaction_subject] => 
    [payment_gross] => 298.44
    [ipn_track_id] => 8656eb7f3009dd4
)

    [posted_date] => 2015 to-05-28 09:10:34
)

you can get mc_gross value

echo $arr['log']['mc_gross']

Just use this:

$YOUR_VARIABLE['log']['mc_gross']

Try It now: Get a mc_gross value

<?php

$array= Array
(
    [id] => 5
    [txn_id] => 1fadfa1sfsa2
    [log] => Array
(
    [mc_gross] => 298.44
    [invoice] => 0856545471323
    [protection_eligibility] => Eligible
    [address_status] => confirmed
    [item_number1] => 12299
    [payer_id] => UTU3f7TLQ6DLX4
    [tax] => 0.00
    [address_street] => 1 Main St
    [payment_date] => 02:10:29 May 28, 2015 PDT
    [payment_status] => Completed
    [charset] => windows-1252
    [address_zip] => 95131
    [mc_shipping] => 0.00
    [mc_handling] => 0.00
    [first_name] =>Rohit
    [mc_fee] => 8.95
    [address_country_code] => US
    [address_name] => Rohit
    [notify_version] => 3.8
    [custom] => 
    [payer_status] => verified
    [business] => sunny@gmail.com
    [address_country] => United States
    [num_cart_items] => 1
    [mc_handling1] => 0.00
    [address_city] => San Jose
    [verify_sign] =>   AHr7LP.QXtufNfq97cbEdHHkqfNkJAtdXVkTwL.GBwGZwJBQ5GAJaqaXx
    [payer_email] => rohit@hotmail.com
    [mc_shipping1] => 0.00
    [tax1] => 0.00
    [txn_id] => 1FV62057CK3146235
    [payment_type] => instant
    [last_name] => Vishwakarma
    [address_state] => CA
    [item_name1] => Centro Yas Island Rotana - Demo
    [receiver_email] => sunny@gmail.com
    [payment_fee] => 8.95
    [quantity1] => 1
    [receiver_id] => 6Y6GRJS8NA8JE
    [txn_type] => cart
    [mc_gross_1] => 298.44
    [mc_currency] => USD
    [residence_country] => US
    [test_ipn] => 1
    [transaction_subject] => 
    [payment_gross] => 298.44
    [ipn_track_id] => 8656eb7f3009dd4
)

    [posted_date] => 2015 to-05-28 09:10:34
)
 ?>

This Array Use

  <?php
  $value=$array["log"]["mc_gross"];
  echo $value;
?>

OR

 <?php
 foreach($array["log"] => $key=>$value){
  if($key=="mc_gross"){
    echo $value 
  }

 }
<?php

Simply echo $arr['log']['mc_gross'] will get your desired mc_gross value