PHP  

Replace All Characters of String to Asterisks Except First and Last Characters in PHP

In the world of programming, text manipulation is a common task. These methods are designed to simplify your text manipulation tasks.

Avatar

How to replace all characters of string to asterisks except first and last characters in PHP?

For example test should become t**t and profanity become p******y and so on,

Use the above code. This will fulfill your requirement.

Another code, Here a small function:

This will replace the first and last like *bcdefghijklm* characters from variable $text;

 

Leave a Reply

Your email address will not be published. Required fields are marked *