function _format_nz_phone_number_prefix in Phone 7
Same name and namespace in other branches
- 6 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 include/
phone.nz.inc - Formatting for New Zealand Phone Numbers.
File
- include/
phone.nz.inc, line 216 - 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 . ' ';
}
}