Oihana PHP Standards

MeasureName uses ConstantsTrait

UN/CEFACT Unit of Measure Names, Symbols, and Codes Class (Recommendation 20).

This class provides an extended selection of the most commonly used codes across various commercial and logistical contexts.

For an exhaustive list and official documentation, please consult:

Tags
see
https://unece.org/trade/uncefact/cl-recommendations
example
<?php
$logger->info( json_encode( MeasureNames::PERCENT ) );
$logger->info( json_encode( MeasureNames::getCode( UnitNames::PERCENT ) ) );
$logger->info( json_encode( MeasureNames::getSymbol( UnitNames::PERCENT ) ) );
$logger->info( json_encode( MeasureNames::get( UnitNames::PERCENT ) ) );

Table of Contents

Constants

ACRE  : string = 'Acre'
ACRE_FOOT  : string = 'Acre-Foot'
AMPERE  : string = 'Ampere'
ANGULAR_DEGREE  : string = 'Angular Degree'
BAR  : string = 'Bar'
BARREL  : string = 'Barrel'
BECQUEREL  : string = 'Becquerel'
BIT  : string = 'Bit'
BYTE  : string = 'Byte'
CALORIE  : string = 'Calorie'
CARAT  : string = 'Carat'
CELSIUS  : string = 'Degree Celsius'
CENTILITRE  : string = 'Centilitre'
CENTIMETER  : string = 'Centimeter'
COULOMB  : string = 'Coulomb'
COUNT  : string = 'Count'
CUBIC_CENTIMETER  : string = 'Cubic Centimeter'
CUBIC_DECIMETER  : string = 'Cubic Decimeter'
CUBIC_FOOT  : string = 'Cubic Foot'
CUBIC_METER  : string = 'Cubic Meter'
DAY  : string = 'Day'
DECIBEL  : string = 'Decibel'
DOZEN  : string = 'Dozen'
FAHRENHEIT  : string = 'Degree Fahrenheit'
FARAD  : string = 'Farad'
FOOT  : string = 'Foot'
GIGABYTE  : string = 'Gigabyte'
GRAM  : string = 'Gram'
GRAY  : string = 'Gray'
GROSS  : string = 'Gross'
HECTARE  : string = 'Hectare'
HECTOMETER  : string = 'Hectometer'
HENRY  : string = 'Henry'
HERTZ  : string = 'Hertz'
HOUR  : string = 'Hour'
HUNDRED  : string = 'Hundred'
IMPERIAL_GALLON  : string = 'Imperial Gallon'
INCH  : string = 'Inch'
JOULE  : string = 'Joule'
KELVIN  : string = 'Kelvin'
KILOBYTE  : string = 'Kilobyte'
KILOCALORIE  : string = 'Kilocalorie'
KILOGRAM  : string = 'Kilogram'
KILOHERTZ  : string = 'Kilohertz'
KILOJOULE  : string = 'Kilojoule'
KILOMETER  : string = 'Kilometer'
KILOWATT  : string = 'Kilowatt'
KILOWATT_HOUR  : string = 'Kilowatt-Hour'
LITER  : string = 'Liter'
LUMEN  : string = 'Lumen'
LUX  : string = 'Lux'
MEGABYTE  : string = 'Megabyte'
MEGAHERTZ  : string = 'Megahertz'
METER  : string = 'Meter'
METRIC_TON  : string = 'Metric Ton'
MILE  : string = 'Mile'
MILLIBAR  : string = 'Millibar'
MILLIGRAM  : string = 'Milligram'
MILLILITER  : string = 'Milliliter'
MILLIMETER  : string = 'Millimeter'
MINUTE  : string = 'Minute'
MONTH  : string = 'Month'
NEWTON  : string = 'Newton'
NUMBER  : string = 'Number'
OHM  : string = 'Ohm'
OUNCE  : string = 'Ounce'
PAIR  : string = 'Pair'
PARTS_PER_MILLION  : string = 'Parts Per Million'
PASCAL  : string = 'Pascal'
PER_THOUSAND  : string = 'Per Thousand'
PERCENT  : string = 'Percent'
PIECE  : string = 'Piece'
POINT  : string = 'Point'
POUND  : string = 'Pound'
POUND_FORCE  : string = 'Pound-force'
POUND_PER_SQUARE_INCH  : string = 'Pound per Square Inch'
RADIAN  : string = 'Radian'
RATIO  : string = 'Ratio'
REVOLUTION_PER_MINUTE  : string = 'Revolution per Minute'
SCORE  : string = 'Score'
SECOND  : string = 'Second'
SIEMENS  : string = 'Siemens'
SIEVERT  : string = 'Sievert'
SQUARE_CENTIMETER  : string = 'Square Centimeter'
SQUARE_DECIMETER  : string = 'Square Decimeter'
SQUARE_FOOT  : string = 'Square Foot'
SQUARE_INCH  : string = 'Square Inch'
SQUARE_KILOMETER  : string = 'Square Kilometer'
SQUARE_METER  : string = 'Square Meter'
SQUARE_MILE  : string = 'Square Mile'
SQUARE_MILLIMETER  : string = 'Square Millimeter'
SQUARE_YARD  : string = 'Square Yard'
TEN_PAIRS  : string = 'Ten Pairs'
TESLA  : string = 'Tesla'
THOUSAND  : string = 'Thousand'
UNIT  : string = 'Unit'
UNIT_OF_CAPITAL  : string = 'Unit of Capital'
US_GALLON  : string = 'US Gallon'
VOLT  : string = 'Volt'
WATT  : string = 'Watt'
WEBER  : string = 'Weber'
WEEK  : string = 'Week'
YARD  : string = 'Yard'
YEAR  : string = 'Year'

Properties

$CODES  : array<string|int, mixed>|null
$SYMBOLS  : array<string|int, mixed>|null

Methods

getCode()  : string|null
Returns the official UN/CEFACT code for a given code.
getFromCode()  : string|null
Returns the name with a specific unit code.
getFromSymbol()  : string|null
Returns the name from a specific unit code symbol.
getSymbol()  : string|null
Returns the official UN/CEFACT symbol for a given code.
resetCaches()  : void
Reset the internal cache of the static methods.

Constants

ANGULAR_DEGREE

public string ANGULAR_DEGREE = 'Angular Degree'

CUBIC_CENTIMETER

public string CUBIC_CENTIMETER = 'Cubic Centimeter'

CUBIC_DECIMETER

public string CUBIC_DECIMETER = 'Cubic Decimeter'

CUBIC_METER

public string CUBIC_METER = 'Cubic Meter'

FAHRENHEIT

public string FAHRENHEIT = 'Degree Fahrenheit'

IMPERIAL_GALLON

public string IMPERIAL_GALLON = 'Imperial Gallon'

KILOCALORIE

public string KILOCALORIE = 'Kilocalorie'

KILOWATT_HOUR

public string KILOWATT_HOUR = 'Kilowatt-Hour'

PARTS_PER_MILLION

public string PARTS_PER_MILLION = 'Parts Per Million'

PER_THOUSAND

public string PER_THOUSAND = 'Per Thousand'

POUND_FORCE

public string POUND_FORCE = 'Pound-force'

POUND_PER_SQUARE_INCH

public string POUND_PER_SQUARE_INCH = 'Pound per Square Inch'

REVOLUTION_PER_MINUTE

public string REVOLUTION_PER_MINUTE = 'Revolution per Minute'

SQUARE_CENTIMETER

public string SQUARE_CENTIMETER = 'Square Centimeter'

SQUARE_DECIMETER

public string SQUARE_DECIMETER = 'Square Decimeter'

SQUARE_FOOT

public string SQUARE_FOOT = 'Square Foot'

SQUARE_INCH

public string SQUARE_INCH = 'Square Inch'

SQUARE_KILOMETER

public string SQUARE_KILOMETER = 'Square Kilometer'

SQUARE_METER

public string SQUARE_METER = 'Square Meter'

SQUARE_MILE

public string SQUARE_MILE = 'Square Mile'

SQUARE_MILLIMETER

public string SQUARE_MILLIMETER = 'Square Millimeter'

SQUARE_YARD

public string SQUARE_YARD = 'Square Yard'

UNIT_OF_CAPITAL

public string UNIT_OF_CAPITAL = 'Unit of Capital'

Properties

$CODES

private static array<string|int, mixed>|null $CODES = null

$SYMBOLS

private static array<string|int, mixed>|null $SYMBOLS = null

Methods

getCode()

Returns the official UN/CEFACT code for a given code.

public static getCode(string $name) : string|null
Parameters
$name : string
Return values
string|null

The UN/CEFACT code or null if not found.

getFromCode()

Returns the name with a specific unit code.

public static getFromCode(string $code) : string|null
Parameters
$code : string
Return values
string|null

getFromSymbol()

Returns the name from a specific unit code symbol.

public static getFromSymbol(string $symbol) : string|null
Parameters
$symbol : string
Return values
string|null

getSymbol()

Returns the official UN/CEFACT symbol for a given code.

public static getSymbol(string $code) : string|null
Parameters
$code : string
Return values
string|null

The UN/CEFACT code (e.g., 'KGM') or null if not found.

resetCaches()

Reset the internal cache of the static methods.

public static resetCaches() : void
On this page

Search results