Jump to content

Archived

This topic is now archived and is closed to further replies.

brown2005

Change IP from 000.00.00.000 to 000.##.##.000

Recommended Posts

hi...

i wondered if it was possible to take an IP address and keep the digits at the front and end and use # or * fro the middle two...?

Regards

Richard

Share this post


Link to post
Share on other sites
why would you want to do this the ansaw is yes you can do it with eregi

but why i ask becouse ip always change unless static.

most  isp use dynamic so the change is always unless you get a static ip your lucky.

Share this post


Link to post
Share on other sites
[tt]GhettoCode[sup]TM[/sup][/tt]
[code]
<?php
  function mask_ip($ip) {
      $ip = explode(".", $ip);
      $ip[1] = "###";
      $ip[2] = "###";
      $ip = implode(".", $ip);
      return $ip;
  }

  $ip = "123.123.123.123"; // example
  $ip = mask_ip($ip); // useage
?>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.