Oihana PHP Standards

MeasureSymbol uses ConstantsTrait

UN/CEFACT Unit of Measure Symbols Enumeration Class (Recommendation 20).

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

It mirrors MeasureCode and MeasureName : the three classes declare the same constant names, which is what the cross lookups rely on.

⚠️ Generated by tools/generate-uncefact-rec20.php — do not edit by hand. Edit tools/data/uncefact-rec20-selection.csv and run the generator instead.

Tags
see
https://unece.org/trade/uncefact/cl-recommendations

Table of Contents

Constants

ACRE  : string = 'ac'
ACRE_FOOT  : string = 'ac-ft'
AMPERE  : string = 'A'
ANGULAR  : string = '°'
BAR  : string = 'bar'
BARREL  : string = 'bbl'
BECQUEREL  : string = 'Bq'
BIT  : string = 'bit'
BYTE  : string = 'B'
CALORIE  : string = 'cal'
CARAT  : string = 'ct'
CELSIUS  : string = '°C'
CENTILITRE  : string = 'cL'
CENTIMETER  : string = 'cm'
COULOMB  : string = 'C'
CUBIC_CENTIMETER  : string = 'cm³'
CUBIC_DECIMETER  : string = 'dm³'
CUBIC_FOOT  : string = 'ft³'
CUBIC_METER  : string = 'm³'
DAY  : string = 'day'
DECIBEL  : string = 'dB'
DOZEN  : string = 'dz'
FAHRENHEIT  : string = '°F'
FARAD  : string = 'F'
FOOT  : string = 'ft'
GIGABYTE  : string = 'GB'
GRAM  : string = 'g'
GRAY  : string = 'Gy'
GROSS  : string = 'gr'
HECTARE  : string = 'ha'
HECTOMETER  : string = 'hm'
HENRY  : string = 'H'
HERTZ  : string = 'Hz'
HOUR  : string = 'h'
HUNDRED  : string = '100'
IMPERIAL_GALLON  : string = 'gal (Imp)'
INCH  : string = 'in'
JOULE  : string = 'J'
KELVIN  : string = 'K'
KILOBYTE  : string = 'KB'
KILOCALORIE  : string = 'kcal'
KILOGRAM  : string = 'kg'
KILOGRAM_PER_CUBIC_METER  : string = 'kg/m³'
KILOHERTZ  : string = 'kHz'
KILOJOULE  : string = 'kJ'
KILOMETER  : string = 'km'
KILOWATT  : string = 'kW'
KILOWATT_HOUR  : string = 'kWh'
LITER  : string = 'L'
LUMEN  : string = 'lm'
LUX  : string = 'lx'
MEGABYTE  : string = 'MB'
MEGAHERTZ  : string = 'MHz'
METER  : string = 'm'
METRIC_TON  : string = 't'
MILE  : string = 'mi'
MILLIBAR  : string = 'mbar'
MILLIGRAM  : string = 'mg'
MILLILITER  : string = 'mL'
MILLIMETER  : string = 'mm'
MINUTE  : string = 'min'
MONTH  : string = 'month'
NEWTON  : string = 'N'
OHM  : string = 'Ω'
OUNCE  : string = 'oz'
PAIR  : string = 'pr'
PARTS_PER_MILLION  : string = 'ppm'
PASCAL  : string = 'Pa'
PER_THOUSAND  : string = '‰'
PERCENT  : string = '%'
PIECE  : string = 'pc'
POUND  : string = 'lb'
POUND_FORCE  : string = 'lbf'
POUND_PER_SQUARE_INCH  : string = 'psi'
RADIAN  : string = 'rad'
REVOLUTION_PER_MINUTE  : string = 'rpm'
SCORE  : string = 'score'
SECOND  : string = 's'
SIEMENS  : string = 'S'
SIEVERT  : string = 'Sv'
SQUARE_CENTIMETER  : string = 'cm²'
SQUARE_DECIMETER  : string = 'dm²'
SQUARE_FOOT  : string = 'ft²'
SQUARE_INCH  : string = 'in²'
SQUARE_KILOMETER  : string = 'km²'
SQUARE_METER  : string = 'm²'
SQUARE_MILE  : string = 'mi²'
SQUARE_MILLIMETER  : string = 'mm²'
SQUARE_YARD  : string = 'yd²'
TEN_PAIRS  : string = '10pr'
TESLA  : string = 'T'
THOUSAND  : string = '1000'
UNIT  : string = 'un'
US_GALLON  : string = 'gal (US)'
VOLT  : string = 'V'
WATT  : string = 'W'
WEBER  : string = 'Wb'
WEEK  : string = 'wk'
YARD  : string = 'yd'
YEAR  : string = 'yr'

Properties

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

Methods

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

Constants

IMPERIAL_GALLON

public string IMPERIAL_GALLON = 'gal (Imp)'

KILOGRAM_PER_CUBIC_METER

public string KILOGRAM_PER_CUBIC_METER = 'kg/m³'

POUND_PER_SQUARE_INCH

public string POUND_PER_SQUARE_INCH = 'psi'

REVOLUTION_PER_MINUTE

public string REVOLUTION_PER_MINUTE = 'rpm'

Properties

$CODES

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

$NAMES

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

Methods

getCode()

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

public static getCode(string $symbol) : string|null
Parameters
$symbol : string

The UN/CEFACT symbol (e.g., 'kg').

Return values
string|null

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

getFromCode()

Returns the symbol matching a specific unit code.

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

The UN/CEFACT code (e.g., 'KGM').

Return values
string|null

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

getFromName()

Returns the symbol matching a specific unit name.

public static getFromName(string $name) : string|null
Parameters
$name : string

The UN/CEFACT name (e.g., 'Kilogram').

Return values
string|null

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

getName()

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

public static getName(string $symbol) : string|null
Parameters
$symbol : string

The UN/CEFACT symbol (e.g., 'kg').

Return values
string|null

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

resetCaches()

Reset the internal cache of the static methods.

public static resetCaches() : void
On this page

Search results