function keyval_str($data) { $res = ''; if (is_array($data)) { foreach ($data as $item) { foreach ($item as $key => $val) { if (is_echoable($val)) { $res .= $key . '=' . $val . '; '; } else { $res .= $key . '=' . json_encode($val) . '; '; } } } } else { $res = json_encode($data) . '; '; } return $res; }
function keyval_str($data) { $accept_keys = array('ui', 'os', 'ky', 'id', 'abi', 'mf', 'sr', 'pcn', 'ram', 'ch', 'et', 'ei', 'pi'); $res = ''; if (is_array($data)) { foreach ($data as $item) { foreach ($item as $key => $val) { if (is_echoable($val)) { $appends = $key . '=' . $val . '; '; } else { $appends = $key . '=' . json_encode($val) . '; '; } if (in_array($key, $accept_keys)) { $res .= $appends; $accept_keys = array_diff($accept_keys, array($key)); } } } } else { $res = json_encode($data) . '; '; } return $res; }