[Solved] cant access json array using php [closed]


Look at documentation:

 json_decode(
    string $json,
    ?bool $associative = null,
    int $depth = 512,
    int $flags = 0
): mixed

and you are passing second argument as true, so it returns array and not object.

And you missing intermediate keys.


So final solution would be:

$update = file_get_contents('php://input');
$update = json_decode($update, true);
$callbak = $update['result'][0]['callback_query']['data'];

1

solved cant access json array using php [closed]