Let's take a look at the problem with this simple code.
Private function getUserInfo (callable $ Human) {try {$ users = (new $ Human)-> getUser () ['users']; $ underageUsers = [foreach ($ users as $ user) if ($ user-> age <18) yield $ user]; list ($ userNames, $ ages) = array_map (function ($ value) {return array_column ($ value, array ('usernames', 'ages '), default) ;}, mb_convert_encoding ($ underageUsers, 'utf-8', 'gbk'); return ['name' => $ userNames, 'surname' => $ ages];} catch (Exception $ e) {error_log ($ e );}}
Reply to discussion (solution)
What is callable? Define it!
Callable is a placeholder for the prompt.
Description: the parameter is the resource body that can be called.
This code is really fashionable. a bunch of php 5.5 features.
$ UnderageUsers is an array. When can mb_convert_encoding accept an array as a parameter?