I've been working with PHP and I'm facing a little issue. I need to hide/mask an IP address (which is stored as a string) using PHP and regular expressions. I've searched online but couldn't find a clear solution for my problem.
To provide some context, I have a website that logs IP addresses of visitors for security purposes. However, for privacy reasons, I would like to hide/mask the IP addresses before storing them in the database.
I believe that using regular expressions in PHP would be the way to go, but I'm unsure about the exact steps and syntax required to achieve this. I want to replace certain sections of the IP address with asterisks (*) so that it becomes unreadable.
For example, I want to transform an IP address like "123.456.789.123" into something like "123.456.***.***".
If anyone has experience with PHP and regular expressions and can guide me on how to accomplish this, I would greatly appreciate it. Thank you in advance for your help!