Checking for existing key in multi-dimensional array
You can just do this!

if (isset($array["message"]["action"])) { /*...*/ }


Proof:

&lt;?php

error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);

$array = [
    "id" =&gt; 1,
    "name" =&gt; "foo",
    "message" =&gt; [
        "action" =&gt; "PUT",
    ],
];

var_dump(isset($array["message"]["action"])); // true


$array = [
    "id" =&gt; 1,
    "name" =&gt; "foo"
];

var_dump(isset($array["message"]["action"])); // false


No log entries.

Do note that if your value is null, then isset will also return false. You probably shouldn't be creating values with null.