php8.5
Home/ Manual/ network / functions/ net_get_interfaces

net_get_interfaces

PHP function Edit on GitHub ✎

(PHP 7 >= 7.3, PHP 8)

Get network interfaces

Description

net_get_interfaces(): array|false

Returns an enumeration of network interfaces (adapters) on the local machine.

Parameters Parameters

Return Values

Returns an associative Array where the key is the name of the interface and the value an associative array of interface attributes, Falseforfailure.

Each interface associative array contains:

NameDescription
descriptionOptional string value for description of the interface. Windows only.
macOptional string value for MAC address of the interface. Windows only.
mtuInteger value for Maximum transmission unit (MTU) of the interface. Windows only.
unicastArray of associative arrays, see Unicast attributes below.
upBoolean status (on/off) for interface.
NameDescription
flagsInteger value.
familyInteger value.
addressString value for address in either IPv4 or IPv6.
netmaskString value for netmask in either IPv4 or IPv6.

Errors/Exceptions

Emits an E_WARNING on failure to get interface information.

Source: reference/network/functions/net-get-interfaces.xml · from the official PHP manual (php/doc-en)