Oihana PHP Standards

MeasureSymbol uses ConstantsTrait

UN/CEFACT Unit of Measure Symbols and Codes Enumeration 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( MeasureSymbols::PERCENT ) );
$logger->info( json_encode( MeasureSymbols::getCode( UnitSymbols::PERCENT ) ) );
$logger->info( json_encode( MeasureSymbols::getName( UnitSymbols::PERCENT ) ) );
$logger->info( json_encode( MeasureSymbols::get( UnitSymbols::PERCENT ) ) );

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'
COUNT  : string = '#'
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'
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'
NUMBER  : string = 'qty'
OHM  : string = 'Ω'
OUNCE  : string = 'oz'
PAIR  : string = 'pr'
PARTS_PER_MILLION  : string = 'ppm'
PASCAL  : string = 'Pa'
PER_THOUSAND  : string = '‰'
PERCENT  : string = '%'
PIECE  : string = 'pc'
POINT  : string = 'pt'
POUND  : string = 'lb'
POUND_FORCE  : string = 'lbf'
POUND_PER_SQUARE_INCH  : string = 'psi'
RADIAN  : string = 'rad'
RATIO  : string = 'ratio'
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'
UNIT_OF_CAPITAL  : string = 'UC'
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 with a specific unit code.
getFromName()  : string|null
Returns the symbol from 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

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
Return values
string|null

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

getFromCode()

Returns the symbol with a specific unit code.

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

getFromName()

Returns the symbol from a specific unit name.

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

getName()

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

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

The UN/CEFACT name or null if not found.

resetCaches()

Reset the internal cache of the static methods.

public static resetCaches() : void
On this page

Search results