PHP Identifiers

Notes:

PHP Identifiers

Identifier: (User defined names)
Identifier is a sequence of characters; which help us to identify specific part of a program
Identifiers are names given to the program elements by the programmer
Ex:
name of a variable
name of a constant
name of an array
name of a function
name of an class, interface, namespace
etc.

Naming conventions: are the rules for writing identifier names
1. Identifiers must be descriptive and meaningful
2. Keywords should never be used as identifiers
3. The first character can be an alphabet or underscore
4. The first character should not be a number
5. All succeeding characters can be alphabets, a digits, or underscores
6. No special characters are allowed except an underscore or dollar
7. Identifiers are case sensitive

Ex:
Valid:
Variable Names: $s, $Num, $num, $score, $_flag, $player9, $price, $studentNames etc.
Constant Names: SCREEN_WIDTH, SCREEN_HEIGHT
Function Names: set_width(), set_height(),
Class, Interface, Namespace names: Student, Math, etc.

Invalid: $9thplayer, continue, etc.

Interview Questions:

1. PHP stands for ______________
a. Hypertext Preprocessor
b. Preprocessor Hypertext
c. Personal Home Processor
d. Personal Hypertext processor
Ans: a