PHP 8.4.0 RC4 available for testing

net_get_interfaces

(PHP 7 >= 7.3, PHP 8)

net_get_interfacesGet network interfaces

Beschreibung

net_get_interfaces(): array|false

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

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Returns an associative Array where the key is the name of the interface and the value an associative array of interface attributes, Bei einem Fehler wird false zurückgegeben..

Each interface associative array contains:

Interface attributes
Name Beschreibung
description Optional string value for description of the interface. Windows only.
mac Optional string value for MAC address of the interface. Windows only.
mtu Integer value for Maximum transmission unit (MTU) of the interface. Windows only.
unicast Array of associative arrays, see Unicast attributes below.
up Boolean status (on/off) for interface.

Unicast attributes
Name Beschreibung
flags Integer value.
family Integer value.
address String value for address in either IPv4 or IPv6.
netmask String value for netmask in either IPv4 or IPv6.

Fehler/Exceptions

Emits an E_WARNING on failure to get interface information.

add a note

User Contributed Notes 1 note

up
-3
Anonymous
2 years ago
The 'unicast' might also contain the 'broadcast' attribute, which is not listed above. Tested on linux with PHP 8.
To Top