Skip to content

Instantly share code, notes, and snippets.

@Gummibeer
Created August 25, 2020 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gummibeer/bcce90064eca8fb390931609ad7b89d0 to your computer and use it in GitHub Desktop.
Save Gummibeer/bcce90064eca8fb390931609ad7b89d0 to your computer and use it in GitHub Desktop.
class IpAddress
{
public string $ip;
public function __construct(string $ip)
{
$this->ip = $ip;
}
public function __toString(): string
{
return $this->ip;
}
}
$ips = [
new IpAddress('127.0.10.123'),
new IpAddress('255.0.0.1'),
new IpAddress('127.0.0.10'),
new IpAddress('50.0.4.120'),
];
natsort($ips);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment