Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncate an IP address? :)

Status
Not open for further replies.

k3bap

Programmer
Jul 9, 2003
8
GB
I need to truncate an IP address so that if I have

192.168.0.1

I end up with

192.168.0

any ideas what would be the best way to do this?
 
solved it

$words = explode(".", $ip);

echo ($words[0].".".$words[1].".".$words[2]);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top