1. Home
  2. Computer Science MCQs
  3. PHP
  4. Which one of the following is not a valid class name?

Added 22 Jan 2024

Which one of the following is not a valid class name?

  1. ShopProduct
  2. Shopproduct
  3. Shopproduct1
  4. 1shopproduct Correct answer

Correct answer

D. 1shopproduct

10 views

MCQSEXAM

Explanation

1shopproduct is not a valid class name because PHP class names must begin with a letter or an underscore — never a digit. After the first character, letters, digits and underscores are all allowed.

That is why ShopProduct, Shopproduct and Shopproduct1 are all acceptable. Class names are also case-insensitive in PHP, although consistent StudlyCaps naming is the accepted convention.

Keep preparing with more Computer Science MCQs on MCQsExam.com.

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More PHP MCQs

Practise all PHP MCQs

Similar MCQs