PHP Basics
1. | What does PHP stand for? |
---|
A. Personal Home Page
B. Preprocessor Hypertext Page
C. PHP Hypertext Preprocessor
D. Preprocessor Hypertext Processor
View Answer Discuss Work SpaceAnswer: option c
Explanation:
PHP stands for PHP Hypertext Preprocessor. This is a recursive acronym, which means that one of the letters in the abbreviation stands for the abbreviation itself.
2. | Which of the following is used to comment out a single line in PHP? |
---|
A. //
B. #
C. /*
D. //
View Answer Discuss Work SpaceAnswer: option a
Explanation:
In PHP, the double slash (//) is used to comment out a single line of code.
3. | Which of the following is used to concatenate two strings in PHP? |
---|
A. .
B. ,
C. +
D. -
View Answer Discuss Work SpaceAnswer: option a
Explanation:
In PHP, the dot (.) is used to concatenate two strings.
4. | Which of the following is not a valid variable name in PHP? |
---|
A. $my_var
B. $MyVar
C. $_myvar
D. $my-var
View Answer Discuss Work SpaceAnswer: option d
Explanation:
Variable names in PHP can only contain letters, numbers, and underscores. They cannot contain dashes.
5. | What is the correct way to assign a value to a variable in PHP? |
---|
A. x = 5;
B. $x = "5";
C. $x == 5;
D. $x = 5;
View Answer Discuss Work SpaceAnswer: option d
Explanation:
The correct way to assign a value to a variable in PHP is to use the equals sign (=) like this: $x = 5;