public static function convertAddressTwo($data, $array = 1)
{
$dataNew = array();
if ($array == 1) {
$dataNew[0] = array();
$dataNew[1] = array();
$dataNew[2] = array();
} else {
$dataNew[0] = new StdClass();
$dataNew[1] = new StdClass();
$dataNew[2] = new StdClass();
}
if (!empty($data)) {
foreach ($data as $k => $v) {
$pos = strpos($k, '_phs');
if ($pos === false) {
if ($array == 1) {
$dataNew[0][$k] = $v;
} else {
$dataNew[0]->{$k} = $v;
}
} else {
$kx = str_replace('_phs', '', $k);
if ($array == 1) {
$dataNew[1][$kx] = $v;
$dataNew[2][$k] = $v;
} else {
$dataNew[1]->{$kx} = $v;
$dataNew[2]->k = $v;
}
}
}
}
if (!empty($dataNew[1])) {
if ($array == 1) {
$dataNew[1]['type'] = 1;
$dataNew[2]['type'] = 1;
} else {
$dataNew[1]->type = 1;
$dataNew[2]->type = 1;
}
}
return $dataNew;
}