0

I'm getting

PHP Notice: Trying to get property of non-object error in getting data.

Code:

array (
  'mmp_txn' => '100000706940',
  'mer_txn' => '176168',
  'amt' => '1.00',
  'prod' => 'NSE',
  'date' => 'Mon Feb 12 16:15:10 IST 2018',
  'bank_txn' => '123123',
  'f_code' => 'Ok',
  'clientcode' => '123',
  'bank_name' => 'ATOM PG',
  'auth_code' => '323232',
  'ipg_txn_id' => '0118043245103',
  'merchant_id' => '197',
  'desc' => 'Transction Success',
  'udf9' => 'null',
  'discriminator' => 'DC',
  'surcharge' => '0.00',
  'CardNumber' => '555555XXXXXX4444',
  'udf1' => 'Test Name',
  'udf2' => 'test@test.com',
  'udf3' => '9999999999',
  'udf4' => 'Mumbai',
  'udf5' => 'null',
  'udf6' => 'null',
  'signature' => '6da0c1ec9f142fa437a9113e20377bc413faa840a0f7dea8499731d40ef79675afe12a1625025d896fabbbbf6c6755366a672c805ec298580848626b95f7b215',
)

I want to convert to string using foreach, but couldn't make it happen. I have tried with

 foreach ($arr as $key => $value) {

        echo $value->desc; 
         echo $value->mer_txn;
       }

But getting the same error.

halfer
  • 19,824
  • 17
  • 99
  • 186
Swagatika
  • 377
  • 1
  • 13

1 Answers1

0

you can get simply with print $value

foreach ($arr as $key => $value) {
            echo $key. "--". $value; echo "<br/>"; 
       }
prakash tank
  • 1,269
  • 1
  • 9
  • 15