php - Show part of a IP address -



php - Show part of a IP address -

85.124.99.2

how can hide lastly 2 numbers ip?

and create like:

86.124.xxx.xxx

wrote quickly

$ip = "85.124.99.2"; $parts = explode('.',$ip); $new_ip = $parts[0].'.'.$parts[1].'.xxx.xxx';

warning: should test length of parts before accessing $parts[n]

php string ip-address

Comments

Popular posts from this blog

c# - Move local mssql database to webhosted MYSQL -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -

java - How to pass parameters between Request-Scoped Controllers? -