How can I use PHP to add the phone number and name to the star number? I found a www. haogongju. netart848588preg_replace (0 [0-9] {2, 3} [-]? [2-9]) [0-9] {3, 4} ([0-9] {3} [-]? [0-9]?) I, $1 ***** $2, $ phone); I want to add the phone number and phone number (8-digit fixed-line phone number or mobile phone 1 using PHP to add the phone number and name to the star number?
I found a textbook online.
Http://www.haogongju.net/art/848588
Preg_replace ('/(0 [0-9] {2, 3} [\-]? [2-9]) [0-9] {3, 4} ([0-9] {3} [\-]? [0-9]?) /I ',' $1 ***** $ 2', $ phone );
I want to change the name and phone number (8-digit fixed phone number or the middle part of mobile phone 11 *
------ Solution --------------------
PHP code
$ Tel1 = "13888111188"; $ tel2 = "+ 8613888111188"; $ tel3 = "0861088111188"; $ tel4 = "086-010-88111188 "; echo preg_replace ('/(^. *) \ d {4} (\ d {4}) $/',' \ 1 ***** \ 2', $ tel1), "\ n "; echo preg_replace ('/(^. *) \ d {4} (\ d {4}) $/',' \ 1 *** \ 2 ', $ tel2), "\ n "; echo preg_replace ('/(^. *) \ d {4} (\ d {4}) $/',' \ 1 ***** \ 2', $ tel3), "\ n "; echo preg_replace ('/(^. *) \ d {4} (\ d {4}) $/',' \ 1 ***** \ 2', $ tel4), "\ n ";
------ Solution --------------------
PHP code
// Shield the four-digit function hidtel ($ phone) {$ IsWhat = preg_match ('/(0 [0-9] {2, 3} [\-]? [2-9] [0-9] {6, 7} [\-]? [0-9]?) /I ', $ phone); // fixed phone if ($ IsWhat = 1) {return preg_replace ('/(0 [0-9] {2, 3} [\-]? [2-9]) [0-9] {3, 4} ([0-9] {3} [\-]? [0-9]?) /I ',' $1 ***** $ 2', $ phone );} else {return preg_replace ('/(1 [358] {1} [0-9]) [0-9] {4} ([0-9] {4 }) /I ',' $1 ***** $ 2', $ phone );}}