public static function getOrdinalForName($enumType, $name)
    {
        $constants = $enumType::values();
        $result = null;

        foreach ($constants as $constant) {
            if ($constant->getName() === $name) {
                $result = $constant->getOrdinal();
                break;
            }
        }

        return $result;
    }
public static function getOrdinalForName($enumType, $name)
    {
        $constants = $enumType::values();
        $result = null;

        foreach ($constants as $constant) {
            if ($constant->getName() === $name) {
                $result = $constant->getOrdinal();
                break;
            }
        }

        return $result;
    }
public static function getOrdinalForName ( $ enumType , $ name ) { $ constants = $ enumType :: values ( ) ; $ result = null ; foreach ( $ constants as $ constant ) { if ( $ constant -> getName ( ) === $ name ) { $ result = $ constant -> getOrdinal ( ) ; break ; } } return $ result ; }
Returns the ordinal of the enumeration constant of the specified
enumeration type with the specified name.

@param string $enumType The class name of the enumeration type from which
to return the name of the enumeration constant.
@param string $name     The name of the enumeration constant to return.

@return integer|null The ordinal of the enumeration constant of the
specified enumeration type with the specified
ordinal on success; `null` on failure.
Returns the ordinal of the enumeration constant of the specified enumeration type with the specified name .