Say I have a data structure like this:
array(3) {
["id"]=>
int(1)
["name"]=>
string(3) "foo"
["message"]=>
array(1) {
["action"]=>
string(3) "PUT"
}
}
Where 'message' and 'action' are both optional. To check if they're present my first attempt would be to write something like this:
if (array_key_exists('message', $array) && array_key_exists('action', $array['message'])){
}
Is there a cleaner implementation?