How to handle this array code with php?

Asked

Viewed 55 times

1

I have a question, how to treat this array:

["*original"]=>


array(13) {
["id"]=>
int(1)
["user_id"]=>
int(3)
["reference"]=>
string(36) "c8d2076672c9631e8c048589f3a9a26f3961"
["status"]=>
string(8) "Pendente"
["paymentMethod"]=>
string(2) "ph"
["date"]=>
string(10) "2018-08-30"
["paymentLink"]=>
string(195) ""
["created_at"]=>
string(19) "2018-08-30 17:41:39"
["updated_at"]=>
string(19) "0000-00-00 00:00:00"
["pacote"]=>
int(1)
["tipo"]=>
string(20) "Ativação de pacote"
["valor"]=>
float(0)
["transaction_id"]=>
NULL

}

Precio retrieve the transaction_id array, but the ["*original"] attribute does not, because of this asteristico.

Someone to settle with me?

1 answer

0

Theoretically this would be:

$recuperado = $var["*original"]["transaction_id"];

var_dump($recuperado);

But as your array shows NULL:

["transaction_id"]=>
NULL

Then the value is null.

The asterisk does not disturb anything, see the test: https://ideone.com/cPnbtZ, probably the problem is in the value null or something you did wrong in the syntax of your personal code

  • so it won’t no

  • Undefined *original

  • @Alissonmaciel if it won’t it is because you are with a different variable, or something like that, in the link I sent showed, it works, the problem is something you did, probably the array should have more dimensions.

Browser other questions tagged

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