Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793258
IP.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
756 B
Referenced Files
None
Subscribers
None
IP.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
Keruald\OmniTools\Network
;
class
IP
{
public
static
function
isIP
(
string
$ip
)
:
bool
{
return
self
::
isIPv4
(
$ip
)
||
self
::
isIPv6
(
$ip
);
}
public
static
function
isIPv4
(
string
$ip
)
:
bool
{
return
filter_var
(
$ip
,
FILTER_VALIDATE_IP
,
FILTER_FLAG_IPV4
)
!==
false
;
}
public
static
function
isIPv6
(
string
$ip
)
:
bool
{
return
filter_var
(
$ip
,
FILTER_VALIDATE_IP
,
FILTER_FLAG_IPV6
)
!==
false
;
}
public
static
function
isLoopback
(
string
$ip
)
:
bool
{
$ranges
=
IPRange
::
getLoopbackRanges
();
foreach
(
$ranges
as
$range
)
{
if
(
$range
->
contains
(
$ip
))
{
return
true
;
}
}
return
false
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 21:45 (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2436109
Default Alt Text
IP.php (756 B)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment