Tokens in PHP
In this article, we will discuss tokens in PHP. Before that, First we learn to know any language by its character set
The character set of PHP
How do we learnt English language?
- Digits : 0, 1,2,3,4,5,6,7,8,9
- Alphabets: A – Z, a- z
- Special Characters : , , ., :, ;, !, @, #, $, %,^,&,*,(, ), +, -, etc
Character set: set of characters used in the language for forming words, sentences, paragraphs, etc,
As PHP is also a language, it also has a set of characters used in forming tokens, instructions, functions, etc.
PHP used ASCII characters set to define all its language constructs
ASCII (7 bit – 128): American Standards Code for Information Interchange. For every character ther is unique number in ASCII Character set.
Decimal | Symbol | Decimal | Symbol | Decimal | Symbol | Decimal | Symbol |
---|---|---|---|---|---|---|---|
0 | Null character (\0) | 32 | space | 64 | @ | 96 | . |
1 | start of heading | 33 | ! | 65 | A | 97 | a |
2 | star of text | 34 | * | 66 | B | 98 | b |
3 | End of text | 35 | # | 67 | C | 99 | c |
Tokens of PHP language
The “Smallest Unit” of any programming language is generally called a Token (w0rd).
- C – Commentsa
- K – Keywords and Data Types
- I – Identifiers
- C – Constants and Variables
- S – Strings and Characters
- O – Operators: LARA BICS
- – L – Logical (&&, ||, !, and , or, xor)
– A – Arithmetic (+, -, *, /, %, **)
– R – Relational (<, >, <=, >=, ==, !=, <>, ===, !==)
– A- Assignment ( = )
– Arithmetic Assignment ( shorthand assignment) : (+=, -=, *=, /=, %=)- B – Bitwise (&, |, ~, ^)
– I – Increment and Decrement( ++, –)
– C – Conditional(?:)
– S – Sting operator (. , .=)
– Special operators ( ->, ::, =>) - S – Separators, ([] ( Array dimension), ; (Semicolon), (comma), {} (Block separator) and more)