The four digits in the middle of the mobile phone number processed by php are asterisks *****, and the mobile phone number asterisks

Source: Internet
Author: User

The four digits in the middle of the mobile phone number processed by php are asterisks *****, and the mobile phone number asterisks

In the scenario of displaying the user list, the mobile phone number must be processed when the mobile phone number is displayed. Generally, the four digits in the middle must be replaced by an asterisk ****, I am using php to replace the four digits in the middle of the mobile phone number ***.

The Code is as follows:

$ All_lottery_logs = ********; // This statement is a winning record. // traverse and process the mobile phone number foreach ($ all_lottery_logs as $ k => $ v) {$ xing = substr ($ v ['tel'], 3,4 ); // obtain the four digits in the middle of the mobile phone number $ all_lottery_logs [$ k] ['tel'] = str_replace ($ xing, '***', $ v ['tel']); // Replace}

In general, the code is relatively simple and the efficiency is not high, but because the project data volume is small, so we should handle it first. We welcome to propose a better method.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.