wc_format_phone_number( string $phone )

Format phone numbers.


Description Description


Parameters Parameters

$phone

(Required) Phone number.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/wc-formatting-functions.php

function wc_format_phone_number( $phone ) {
	if ( ! WC_Validation::is_phone( $phone ) ) {
		return '';
	}
	return preg_replace( '/[^0-9\+\-\(\)\s]/', '-', preg_replace( '/[\x00-\x1F\x7F-\xFF]/', '', $phone ) );
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.