Oihana Php Masking

maskZip.php

Table of Contents

Functions

maskZip()  : string
Replaces a zip / postal code with a random one of the same shape.

Functions

maskZip()

Replaces a zip / postal code with a random one of the same shape.

maskZip(mixed $value[, string $default = '12345' ]) : string

Implements the conventional zip masker: each digit becomes a random digit, each letter a random letter (case kept), other characters are left unchanged. When the value is not a string, the default fallback is used.

Parameters
$value : mixed

The original value.

$default : string = '12345'

Fallback when the value is not a string.

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

maskZip( '50674' );   // e.g. "98146"
maskZip( 'SA34-EA' ); // e.g. "OW91-JI"
maskZip( null );      // "12345" (default)
since
1.0.0
author

Marc Alcaraz

Return values
string
On this page

Search results