Vidyalelo
PHP · Q51

Object Oriented Concept

Programming · PHP · question 51

Q51

Which one of the following is the right way to define a constant?

A.
constant PI = “3.1415”;
B.
const $PI = “3.1415”;
C.
constant PI = ‘3.1415’;
D.
const PI = ‘3.1415’;
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
Class constants are created like: const NAME = ‘VALUE’;