function FormataTelefone($aux){ $s=""; for ($x=1; $x<=strlen($aux); $x=$x+1){ $ch=substr($aux,$x-1,1); if (ord($ch)>=48 && ord($ch)<=57){ $s=$s.$ch; } } if($s[0]=='0') $s=substr($s,1); if(strlen($s)!=10) return False; $tel="("; $tel.=substr($s,0,2); $tel.=") "; $tel.=substr($s,2,4); $tel.="-"; $tel.=substr($s,6,4); return $tel; }