: This article mainly introduces full-width conversion in php. if you are interested in the PHP Tutorial, please refer to it.
// Halfwidth array $ half = array ('0', '1', '2', '3', '4', '5', '6 ', '7', '8', '9', 'A', 'B', 'C', 'D', 'e', 'F', 'G ', 'H', 'I', 'J', 'K', 'L', 'M', 'n', 'O', 'P', 'Q ', 'R', 'S', 'T', 'u', 'V', 'W', 'X', 'y', 'z', 'A ', 'B', 'C', 'D', 'e', 'F', 'G', 'H', 'I', 'J', 'K ', 'L', 'M', 'n', 'O', 'P', 'Q', 'R', 'S', 'T', 'u ', 'V', 'W', 'X', 'y', 'z ','-','_','. ','@','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ', 'Hangzhou ','? ','? ','? ','? ','? ','? ','? ','? ', 'Hangzhou ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? ','? '); // Fullwidth array $ full = array ('0', '1', '2', '3', '4', '5', '6 ', '7', '8', '9', 'A', 'B', 'C', 'D', 'e', 'F', 'G ', 'H', 'I', 'J', 'K', 'L', 'M', 'n', 'O', 'P', 'Q ', 'R', 'S', 'T', 'u', 'V', 'W', 'X', 'y', 'z', 'A ', 'B', 'C', 'D', 'e', 'F', 'G', 'H', 'I', 'J', 'K ', 'L', 'M', 'n', 'O', 'P', 'Q', 'R', 'S', 'T', 'u ', 'V', 'W', 'X', 'y', 'z ','-','_','. ',' @ ', 'handler ', 'Taobao ', 'Taobao ',' Comment ', 'Taobao ', 'Taobao ', 'replace ',); var_dump (str_replace ($ half, $ full ,'??? '); // Convert the halfwidth to the fullwidth var_dump (str_replace ($ full, $ half, 'fullwidth failed'); // Convert the fullwidth to halfwidth
The above section describes the full-width conversion in php, including some content. I hope my friends who are interested in the PHP Tutorial will be helpful.