php8.5
Home/ Manual/ snmp / functions/ snmp_set_enum_print

snmp_set_enum_print

PHP function Edit on GitHub ✎

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

Return all values that are enums with their enum value instead of the raw integer

Description

snmp_set_enum_print(bool $enable): true

This function toggles if snmpwalk/snmpget etc. should automatically lookup enum values in the MIB and return them together with their human readable string.

Parameters

enable

As the value is interpreted as boolean by the Net-SNMP library, it can only be "0" or "1".

Return Values

Always

Changelog

VersionDescription

Examples

Using snmp_set_enum_print()

php
<?php
 snmp_set_enum_print(0);
 echo snmpget('localhost', 'public', 'IF-MIB::ifOperStatus.3') . "\n";
 snmp_set_enum_print(1);
 echo snmpget('localhost', 'public', 'IF-MIB::ifOperStatus.3') . "\n";
?>

The above would return INTEGER: up(1) INTEGER: 1

Source: reference/snmp/functions/snmp-set-enum-print.xml · from the official PHP manual (php/doc-en)