Oihana Php Masking

maskPhone.php

Table of Contents

Functions

maskPhone()  : string
Replaces a phone number with a random one of the same shape.

Functions

maskPhone()

Replaces a phone number with a random one of the same shape.

maskPhone(mixed $value[, string $default = '+1234567890' ]) : string

Implements the conventional phone masker: each digit is replaced by a random digit, each letter by a random letter (case kept), and every other character is left unchanged. When the value is not a string, the default fallback is used.

Parameters
$value : mixed

The original value.

$default : string = '+1234567890'

Fallback when the value is not a string.

Tags
throws
RandomException
example
use function oihana\masking\maskPhone;

maskPhone( '+31 66-77-88' ); // e.g. "+75 10-79-52"
maskPhone( 1234 );           // "+1234567890" (default, non-string input)
since
1.0.0
author

Marc Alcaraz

Return values
string
On this page

Search results