-5

i got the following array:

$resultaat= array('AfterPay Result' => $Afterpay->order_result);

And i get the following output:

    Array
(
    [AfterPay Result] => stdClass Object
        (
            [return] => stdClass Object
                (
                    [afterPayOrderReference] => 928241d9d1dfb45d7513f3bbb8f063
                    [checksum] => 8452479310a82dc9a8ce574e6ce180f4
                    [resultId] => 0
                    [statusCode] => A
                    [timestampIn] => 1445938695282
                    [timestampOut] => 1445938700423
                    [transactionId] => 450831
                )

        )

)

How do i retrieve the value: 'statusCode' and the value 'resultId' so i can save them in my database.

can someone please help me?

3 Answers3

1

With the following lines:

$status_code = $resultaat['AfterPay Result']->return->statusCode;
$resultId = $resultaat['AfterPay Result']->return->resultId;

Or direct from the array value (you don't have to set an extra array):

$status_code = $Afterpay->order_result->return->statusCode;
$resultId = $Afterpay->order_result->return->resultId;
Sebastian Brosch
  • 42,106
  • 15
  • 72
  • 87
1

Here is how you retrieve the values:

$resultaat['AfterPay Result']->return->statusCode;
$resultaat['AfterPay Result']->return->resultId;
fos.alex
  • 5,317
  • 4
  • 16
  • 18
  • Could you please add at least one word what are you quoting in here. Your post goes to "low quality post' category which requires or deletion or correction. – holms Oct 28 '15 at 17:23
  • 1
    He asked "How do I retrieve the value?" And I posted the code - which is actually the same one as the accepted answer. But sure, I can add to it... – fos.alex Oct 28 '15 at 18:30
0

Consider useing get_object_vars() to make it an array , that will simplify your problem or you can retrieve it as $resultaat[AfterPay Result]->return->statusCode .

Prafulla Kumar Sahu
  • 9,321
  • 11
  • 68
  • 105