* ** Number to date recursion * @ paramlist * @ returnlist ** functionday2str ($ key, $ obj, $ keysarray (create_time & amp; gt; Y-m-d, s_time & amp; gt; Y-m-d, e_time & amp; gt; Y-m-d, usetime & amp; gt ;...
/*** Recursion of numeric to date * @ param list * @ return list **/function day2str ($ key, $ obj, $ keys = array ('create _ time' => 'Y-m-D','s _ time' => 'Y-m-D ', 'e _ time' => 'Y-m-D', 'usetime' => 'Y-m-d G: I: s ')) {if (is_array ($ obj) {// if it is obj or array foreach ($ obj as $ k => $ v) {$ obj [$ k] = day2str ($ k, $ v, $ keys); // recursion} return $ obj;} else {if (! $ Type = $ keys [$ key]) {// remove the items not in the list: return $ obj;} if (is_numeric ($ key )) {// remove the array type return $ obj;} if (! $ Obj) {// remove the null value return "";} if (! Is_numeric ($ obj) {// remove the transformed return $ obj;} return date ($ type, $ obj); // numeric conversion string}
Usage:
day2str('',$data);