Home > Backend Development > PHP Tutorial > 一个很简单的字符串切分有关问题

一个很简单的字符串切分有关问题

WBOY
Release: 2016-06-13 13:39:45
Original
917 people have browsed it

一个很简单的字符串切分问题
job***@apple.com
chenghai***@qq.com

让@左边的四个字符替换为 “*”

------解决方案--------------------

PHP code


$str = 'tstkfeacbcs@ss.cds';
echo preg_replace('/.{4}@/', '****@', $str);

//tstkfea****@ss.cds <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
str
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template