Oihana PHP Enums

Char uses ConstantsTrait

A comprehensive enumeration of commonly used single-character strings, including punctuation marks, mathematical symbols, whitespace characters, typographic signs, and Unicode superscript/subscript digits.

This class is particularly useful when working with string manipulation, formatting, code generation, or when symbolic constants are preferred over raw string literals for better readability and maintainability.

Features:

  • All constants are strings, representing a wide range of characters.
  • Includes ASCII, Unicode typographic, superscript, and subscript symbols.
  • Helps reduce the use of "magic characters" in your codebase.
  • Designed to be compatible with the ConstantsTrait for reflection or listing.

Example:

use oihana\enums\Char;

echo 'A' . Char::DOT . 'B' ; // Outputs: A.B
echo Char::SUPERSCRIPT_TWO ; // Outputs: ²

echo implode( Char::COMMA . Char::SPACE, ['one', 'two', 'three'] ) ;
Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Constants

AMPERSAND  : string = "&"
APOSTROPHE  : string = "'"
APPROXIMATELY  : string = '≈'
Approximately equal
ASTERISK  : string = '*'
AT_SIGN  : string = '@'
BACK_SLASH  : string = '\\'
BITCOIN_SIGN  : string = '₿'
Bitcoin sign
BULLET  : string = '•'
CARRIAGE_RETURN  : string = self::CR
Carriage Return (CR, ASCII 13) - alias of {@see Char::CR}
CENT_SIGN  : string = '¢'
Cent
CHECK_MARK  : string = '✔'
CIRCUMFLEX  : string = '^'
COLON  : string = ':'
Colon
COMMA  : string = ','
Comma
COPYRIGHT  : string = '©'
CR  : string = "\r"
Carriage Return (CR, ASCII 13)
CRLF  : string = "\r\n"
Carriage Return + Line Feed (CRLF) Canonical Windows / network newline
CROSS_MARK  : string = '✘'
DASH  : string = '-'
DEGREE  : string = '°'
Degree
DIVIDE  : string = '÷'
Division
DOLLAR  : string = '$'
DOLLAR_SIGN  : string = '$'
Dollar sign
DOT  : string = '.'
Dot / period
DOUBLE_ACUTE  : string = '˝'
DOUBLE_BACK_SLASH  : string = '\\\\'
DOUBLE_COLON  : string = '::'
DOUBLE_DOT  : string = '..'
DOUBLE_EQUAL  : string = '=='
DOUBLE_HYPHEN  : string = '--'
DOUBLE_PIPE  : string = '||'
DOUBLE_QUOTE  : string = '"'
DOUBLE_QUOTE_LEFT  : string = '“'
DOUBLE_QUOTE_RIGHT  : string = '”'
DOUBLE_SLASH  : string = '//'
EM_DASH  : string = '—'
EMPTY  : string = ''
EN_DASH  : string = '–'
EOL  : string = PHP_EOL
System-dependent end-of-line (PHP_EOL)
EQUAL  : string = '='
Equal
EURO_SIGN  : string = '€'
Euro sign
EXCLAMATION_MARK  : string = '!'
FF  : string = "\f"
Form Feed (FF, ASCII 12)
FRACTION_SLASH  : string = '⁄'
Fraction slash
GRAVE_ACCENT  : string = '`'
GREATER_EQUAL  : string = '≥'
Greater than or equal
GREATER_THAN  : string = '>'
Greater than
HASH  : string = '#'
HEART  : string = '♥'
HYPHEN  : string = self::DASH
INFINITY  : string = '∞'
Infinity
LEFT_BRACE  : string = '{'
Left brace
LEFT_BRACKET  : string = '['
Left bracket
LEFT_PARENTHESIS  : string = '('
Left parenthesis
LESS_EQUAL  : string = '≤'
Less than or equal
LESS_THAN  : string = '<'
Less than
LF  : string = "\n"
Line Feed (LF, ASCII 10)
LINE_FEED  : string = self::LF
Carriage Return (CR, ASCII 13) - alias of {@see Char::LF}
LINE_SEPARATOR  : string = "
"
Line separator (U+2028)
MICRO_SIGN  : string = 'µ'
MINUS  : string = '-'
Subtraction
MODULUS  : string = '%'
Modulus / percent
MULTIPLY  : string = '×'
Multiplication
NBSP  : string = " "
Non-breaking space (U+00A0)
NEL  : string = "…"
Unicode next line (NEL, U+0085)
NOT_EQUAL  : string = '≠'
Not equal
NUMBER  : string = self::HASH
PARAGRAPH_SEPARATOR  : string = "
"
Paragraph separator (U+2029)
PER_MILLE  : string = '‰'
Per mille
PERCENT  : string = self::MODULUS
PI  : string = 'π'
Pi
PILCROW  : string = '¶'
PIPE  : string = '|'
Vertical bar / pipe
PLUS  : string = '+'
Addition
PLUS_MINUS  : string = '±'
Plus-minus
POUND_SIGN  : string = '£'
Pound sterling
QUESTION_MARK  : string = '?'
QUOTATION_MARK  : string = self::DOUBLE_QUOTE
QUOTE_LEFT  : string = '‘'
QUOTE_RIGHT  : string = '’'
REGISTERED  : string = '®'
RIGHT_BRACE  : string = '}'
Right brace
RIGHT_BRACKET  : string = ']'
Right bracket
RIGHT_PARENTHESIS  : string = ')'
Right parenthesis
RUPEE_SIGN  : string = '₹'
Indian Rupee
SECTION_SIGN  : string = '§'
SEMI_COLON  : string = ';'
SIMPLE_QUOTE  : string = self::APOSTROPHE
SLASH  : string = '/'
SNOWFLAKE  : string = '❄'
SPACE  : string = ' '
Space (ASCII 32)
SQUARE_ROOT  : string = '√'
Square root
SUBSCRIPT_EIGHT  : string = '₈'
SUBSCRIPT_EQUAL  : string = '₌'
SUBSCRIPT_FIVE  : string = '₅'
SUBSCRIPT_FOUR  : string = '₄'
SUBSCRIPT_LEFT_PARENTHESIS  : string = '₍'
SUBSCRIPT_MINUS  : string = '₋'
SUBSCRIPT_NINE  : string = '₉'
SUBSCRIPT_ONE  : string = '₁'
SUBSCRIPT_PLUS  : string = '₊'
SUBSCRIPT_RIGHT_PARENTHESIS  : string = '₎'
SUBSCRIPT_SEVEN  : string = '₇'
SUBSCRIPT_SIX  : string = '₆'
SUBSCRIPT_THREE  : string = '₃'
SUBSCRIPT_TWO  : string = '₂'
SUBSCRIPT_ZERO  : string = '₀'
SUPERSCRIPT_EIGHT  : string = '⁸'
SUPERSCRIPT_EQUAL  : string = '⁼'
SUPERSCRIPT_FIVE  : string = '⁵'
SUPERSCRIPT_FOUR  : string = '⁴'
SUPERSCRIPT_LEFT_PARENTHESIS  : string = '⁽'
SUPERSCRIPT_MINUS  : string = '⁻'
SUPERSCRIPT_NINE  : string = '⁹'
SUPERSCRIPT_ONE  : string = '¹'
SUPERSCRIPT_PLUS  : string = '⁺'
SUPERSCRIPT_RIGHT_PARENTHESIS  : string = '⁾'
SUPERSCRIPT_SEVEN  : string = '⁷'
SUPERSCRIPT_SIX  : string = '⁶'
SUPERSCRIPT_THREE  : string = '³'
SUPERSCRIPT_TWO  : string = '²'
SUPERSCRIPT_ZERO  : string = '⁰'
TAB  : string = "\t"
Horizontal Tab (HT, ASCII 9)
TICK  : string = self::GRAVE_ACCENT
TILDE  : string = '~'
TRADEMARK  : string = '™'
TRIPLE_DOT  : string = '...'
UNDERLINE  : string = '_'
VT  : string = "\v"
Vertical Tab (VT, ASCII 11)
WON_SIGN  : string = '₩'
South Korean Won
YEN_SIGN  : string = '¥'
Yen / Yuan

Constants

AMPERSAND

public string AMPERSAND = "&"

APOSTROPHE

public string APOSTROPHE = "'"

APPROXIMATELY

Approximately equal

public string APPROXIMATELY = '≈'

ASTERISK

public string ASTERISK = '*'

AT_SIGN

public string AT_SIGN = '@'

BACK_SLASH

public string BACK_SLASH = '\\'

BITCOIN_SIGN

Bitcoin sign

public string BITCOIN_SIGN = '₿'

BULLET

public string BULLET = '•'

CARRIAGE_RETURN

Carriage Return (CR, ASCII 13) - alias of {@see Char::CR}

public string CARRIAGE_RETURN = self::CR

CENT_SIGN

Cent

public string CENT_SIGN = '¢'

CHECK_MARK

public string CHECK_MARK = '✔'

CIRCUMFLEX

public string CIRCUMFLEX = '^'

COLON

Colon

public string COLON = ':'

COMMA

Comma

public string COMMA = ','
public string COPYRIGHT = '©'

CR

Carriage Return (CR, ASCII 13)

public string CR = "\r"

CRLF

Carriage Return + Line Feed (CRLF) Canonical Windows / network newline

public string CRLF = "\r\n"

CROSS_MARK

public string CROSS_MARK = '✘'

DASH

public string DASH = '-'

DEGREE

Degree

public string DEGREE = '°'

DIVIDE

Division

public string DIVIDE = '÷'

DOLLAR

public string DOLLAR = '$'

DOLLAR_SIGN

Dollar sign

public string DOLLAR_SIGN = '$'

DOT

Dot / period

public string DOT = '.'

DOUBLE_ACUTE

public string DOUBLE_ACUTE = '˝'

DOUBLE_BACK_SLASH

public string DOUBLE_BACK_SLASH = '\\\\'

DOUBLE_COLON

public string DOUBLE_COLON = '::'

DOUBLE_DOT

public string DOUBLE_DOT = '..'

DOUBLE_EQUAL

public string DOUBLE_EQUAL = '=='

DOUBLE_HYPHEN

public string DOUBLE_HYPHEN = '--'

DOUBLE_PIPE

public string DOUBLE_PIPE = '||'

DOUBLE_QUOTE

public string DOUBLE_QUOTE = '"'

DOUBLE_QUOTE_LEFT

public string DOUBLE_QUOTE_LEFT = '“'

DOUBLE_QUOTE_RIGHT

public string DOUBLE_QUOTE_RIGHT = '”'

DOUBLE_SLASH

public string DOUBLE_SLASH = '//'

EM_DASH

public string EM_DASH = '—'

EMPTY

public string EMPTY = ''

EN_DASH

public string EN_DASH = '–'

EOL

System-dependent end-of-line (PHP_EOL)

public string EOL = PHP_EOL

EQUAL

Equal

public string EQUAL = '='

EURO_SIGN

Euro sign

public string EURO_SIGN = '€'

EXCLAMATION_MARK

public string EXCLAMATION_MARK = '!'

FF

Form Feed (FF, ASCII 12)

public string FF = "\f"

FRACTION_SLASH

Fraction slash

public string FRACTION_SLASH = '⁄'

GRAVE_ACCENT

public string GRAVE_ACCENT = '`'

GREATER_EQUAL

Greater than or equal

public string GREATER_EQUAL = '≥'

GREATER_THAN

Greater than

public string GREATER_THAN = '>'

HASH

public string HASH = '#'

HEART

public string HEART = '♥'

HYPHEN

public string HYPHEN = self::DASH

INFINITY

Infinity

public string INFINITY = '∞'

LEFT_BRACE

Left brace

public string LEFT_BRACE = '{'

LEFT_BRACKET

Left bracket

public string LEFT_BRACKET = '['

LEFT_PARENTHESIS

Left parenthesis

public string LEFT_PARENTHESIS = '('

LESS_EQUAL

Less than or equal

public string LESS_EQUAL = '≤'

LESS_THAN

Less than

public string LESS_THAN = '<'

LF

Line Feed (LF, ASCII 10)

public string LF = "\n"

LINE_FEED

Carriage Return (CR, ASCII 13) - alias of {@see Char::LF}

public string LINE_FEED = self::LF

LINE_SEPARATOR

Line separator (U+2028)

public string LINE_SEPARATOR = "
"

MICRO_SIGN

public string MICRO_SIGN = 'µ'

MINUS

Subtraction

public string MINUS = '-'

MODULUS

Modulus / percent

public string MODULUS = '%'

MULTIPLY

Multiplication

public string MULTIPLY = '×'

NBSP

Non-breaking space (U+00A0)

public string NBSP = " "

NEL

Unicode next line (NEL, U+0085)

public string NEL = "…"

NOT_EQUAL

Not equal

public string NOT_EQUAL = '≠'

NUMBER

public string NUMBER = self::HASH

PARAGRAPH_SEPARATOR

Paragraph separator (U+2029)

public string PARAGRAPH_SEPARATOR = "
"

PER_MILLE

Per mille

public string PER_MILLE = '‰'

PERCENT

public string PERCENT = self::MODULUS

PI

Pi

public string PI = 'π'

PILCROW

public string PILCROW = '¶'

PIPE

Vertical bar / pipe

public string PIPE = '|'

PLUS

Addition

public string PLUS = '+'

PLUS_MINUS

Plus-minus

public string PLUS_MINUS = '±'

POUND_SIGN

Pound sterling

public string POUND_SIGN = '£'

QUESTION_MARK

public string QUESTION_MARK = '?'

QUOTATION_MARK

public string QUOTATION_MARK = self::DOUBLE_QUOTE

QUOTE_LEFT

public string QUOTE_LEFT = '‘'

QUOTE_RIGHT

public string QUOTE_RIGHT = '’'

REGISTERED

public string REGISTERED = '®'

RIGHT_BRACE

Right brace

public string RIGHT_BRACE = '}'

RIGHT_BRACKET

Right bracket

public string RIGHT_BRACKET = ']'

RIGHT_PARENTHESIS

Right parenthesis

public string RIGHT_PARENTHESIS = ')'

RUPEE_SIGN

Indian Rupee

public string RUPEE_SIGN = '₹'

SECTION_SIGN

public string SECTION_SIGN = '§'

SEMI_COLON

public string SEMI_COLON = ';'

SIMPLE_QUOTE

public string SIMPLE_QUOTE = self::APOSTROPHE

SLASH

public string SLASH = '/'

SNOWFLAKE

public string SNOWFLAKE = '❄'

SPACE

Space (ASCII 32)

public string SPACE = ' '

SQUARE_ROOT

Square root

public string SQUARE_ROOT = '√'

SUBSCRIPT_EIGHT

public string SUBSCRIPT_EIGHT = '₈'

SUBSCRIPT_EQUAL

public string SUBSCRIPT_EQUAL = '₌'

SUBSCRIPT_FIVE

public string SUBSCRIPT_FIVE = '₅'

SUBSCRIPT_FOUR

public string SUBSCRIPT_FOUR = '₄'

SUBSCRIPT_LEFT_PARENTHESIS

public string SUBSCRIPT_LEFT_PARENTHESIS = '₍'

SUBSCRIPT_MINUS

public string SUBSCRIPT_MINUS = '₋'

SUBSCRIPT_NINE

public string SUBSCRIPT_NINE = '₉'

SUBSCRIPT_ONE

public string SUBSCRIPT_ONE = '₁'

SUBSCRIPT_PLUS

public string SUBSCRIPT_PLUS = '₊'

SUBSCRIPT_RIGHT_PARENTHESIS

public string SUBSCRIPT_RIGHT_PARENTHESIS = '₎'

SUBSCRIPT_SEVEN

public string SUBSCRIPT_SEVEN = '₇'

SUBSCRIPT_SIX

public string SUBSCRIPT_SIX = '₆'

SUBSCRIPT_THREE

public string SUBSCRIPT_THREE = '₃'

SUBSCRIPT_TWO

public string SUBSCRIPT_TWO = '₂'

SUBSCRIPT_ZERO

public string SUBSCRIPT_ZERO = '₀'

SUPERSCRIPT_EIGHT

public string SUPERSCRIPT_EIGHT = '⁸'

SUPERSCRIPT_EQUAL

public string SUPERSCRIPT_EQUAL = '⁼'

SUPERSCRIPT_FIVE

public string SUPERSCRIPT_FIVE = '⁵'

SUPERSCRIPT_FOUR

public string SUPERSCRIPT_FOUR = '⁴'

SUPERSCRIPT_LEFT_PARENTHESIS

public string SUPERSCRIPT_LEFT_PARENTHESIS = '⁽'

SUPERSCRIPT_MINUS

public string SUPERSCRIPT_MINUS = '⁻'

SUPERSCRIPT_NINE

public string SUPERSCRIPT_NINE = '⁹'

SUPERSCRIPT_ONE

public string SUPERSCRIPT_ONE = '¹'

SUPERSCRIPT_PLUS

public string SUPERSCRIPT_PLUS = '⁺'

SUPERSCRIPT_RIGHT_PARENTHESIS

public string SUPERSCRIPT_RIGHT_PARENTHESIS = '⁾'

SUPERSCRIPT_SEVEN

public string SUPERSCRIPT_SEVEN = '⁷'

SUPERSCRIPT_SIX

public string SUPERSCRIPT_SIX = '⁶'

SUPERSCRIPT_THREE

public string SUPERSCRIPT_THREE = '³'

SUPERSCRIPT_TWO

public string SUPERSCRIPT_TWO = '²'

SUPERSCRIPT_ZERO

public string SUPERSCRIPT_ZERO = '⁰'

TAB

Horizontal Tab (HT, ASCII 9)

public string TAB = "\t"

TICK

public string TICK = self::GRAVE_ACCENT

TILDE

public string TILDE = '~'

TRADEMARK

public string TRADEMARK = '™'

TRIPLE_DOT

public string TRIPLE_DOT = '...'

UNDERLINE

public string UNDERLINE = '_'

VT

Vertical Tab (VT, ASCII 11)

public string VT = "\v"

WON_SIGN

South Korean Won

public string WON_SIGN = '₩'

YEN_SIGN

Yen / Yuan

public string YEN_SIGN = '¥'
On this page

Search results