Hi, how do i actually reverse the subnet mask and write it into a TextFile?
Example: A user enter 255.255.255.0 in a TextBox. But when written into a TextFile, it is being reversed to 0.0.0.255
Thanks in advance!
Display reverse subnet mask
Moderator: General Moderators
Re: Display reverse subnet mask
I'm thinking ip2long, the ~ operator, and long2ip should do the trick.
Code: Select all
$ip = "255.255.255.0";
$reversed = long2ip(~ip2long($ip));
echo $reversed;Re: Display reverse subnet mask
Definitely a better approach than i posted in the other exact same thread.
Ive gone and noted that down for future use too
cheers tasairis.
Ive gone and noted that down for future use too
cheers tasairis.