php mascara cep

Solutions on MaxInterview for php mascara cep by the best coders in the world

showing results for - "php mascara cep"
Greta
02 Mar 2017
1function Mask($mask,$str){
2
3    $str = str_replace(" ","",$str);
4
5    for($i=0;$i<strlen($str);$i++){
6        $mask[strpos($mask,"#")] = $str[$i];
7    }
8
9    return $mask;
10
11}
12
13$cnpj = '17804682000198';
14echo Mask("##.###.###/####-##",$cnpj).'<BR>';
15
16$cpf = '21450479480';
17echo Mask("###.###.###-##",$cpf).'<BR>';
18
19$cep = '36970000';
20echo Mask("#####-###",$cep).'<BR>';
21
22$telefone = '3391922727';
23echo Mask("(##)####-####",$telefone).'<BR>';
24
25$data = '21072014';
26echo Mask("##/##/####",$data);
27