function _format_nz_phone_number_prefix in Phone 6
Same name and namespace in other branches
- 7 include/phone.nz.inc \_format_nz_phone_number_prefix()
Formats the prefix as either +64 4 or (04), depending on the original prefix context
Parameters
string $prefix either '+64' or '0':
string $area_code the area code, eg. 4, 21, 27 etc:
Return value
string the formatted prefix
1 call to _format_nz_phone_number_prefix()
- format_nz_phone_number in ./
phone.nz.inc - Formatting for New Zealand Phone Numbers.
File
- ./
phone.nz.inc, line 217 - CCK Field for New Zealand phone numbers.
Code
function _format_nz_phone_number_prefix($prefix, $area_code) {
$area_code = intval($area_code);
if (in_array($area_code, array(
'800',
'900',
))) {
return $prefix == '0' ? $prefix . $area_code . ' ' : $prefix . ' ' . $area_code . ' ';
}
else {
return $prefix == '0' ? '(' . $prefix . $area_code . ') ' : $prefix . ' ' . $area_code . ' ';
}
}