list of phids */ function phid_group_by_type($phids) { $result = array(); foreach ($phids as $phid) { $type = phid_get_type($phid); $result[$type][] = $phid; } return $result; } function phid_get_subtype($phid) { if (isset($phid[14]) && ($phid[14] == '-')) { return substr($phid, 10, 4); } return null; }