Created
August 25, 2020 08:23
-
-
Save Gummibeer/bcce90064eca8fb390931609ad7b89d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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