ARTICLE AD BOX
Looked into your problem and there were issues. Of course you had a typo, but as you clarified in the comment-section, that was not part of the original problem, but added while typing the question. First of all, if you look at the docs, you'll see this part:
array_find() returns the value of the first element of an array for which the given callback returns true. If no matching element is found the function returns null.
So basically you will get a value from the array (or null if no such value found) where the callback function you passed returns true. Your callback needs to return something. I removed your prints from the insides of the callback function, as they clearly don't belong there and served debugging purposes. array_find will return a value of the array, so you need to pass $data['conf'] in order to get sensible value. Of course, you want only a sub-array of the result, but it's not the job of array_find to extract that part.
Hence I implemented a solution where I:
define the example you provided for $data omit the json_decode of the response, as that clearly was not the problem define a dummy sanitize_text_field function just to make sure the code does not crash remove the unnecessary internals of the callback and return boolean as it should be extract the settings of the configuration afterwards and fall back to some value if the search yielded no result <?php $data = [ 'conf' => [ 0 => [ 'id' => 123, 'configuration' => [ 'title' => 'Settings 1', 'settings' => [ 'color' => 'blue', 'size' => 800 ] ] ] ] ]; $userConf = []; $id = 123; $result = array_find($data['conf'], function($conf) use ($id) { return ($conf['id'] === $id); }); var_dump($result ? $result['configuration']['settings'] : 'not found');