A constant in a PHP class is defined using the const keyword.
- TRUE
- FALSE
- nan
- nan
A constant in a PHP class is indeed defined using the const keyword. It allows you to define a constant within a class by specifying the constant name, the assignment operator =, and the desired value. For example: const CONSTANT_NAME = value; Constants are used to store values that remain the same throughout the execution of a script and cannot be changed once defined. They provide a convenient way to define and use fixed values within a class. Refer to: http://php.net/manual/en/language.constants.php
Loading...
Related Quiz
- What type of operation is needed when passing values through a form or a URL?
- What is a common use case for the $_SERVER superglobal in PHP?
- You are writing a PHP script and you need to include a file. How would you do this?
- How do you sort an associative array by its keys in PHP?
- The else statement in PHP can only be used after an if statement.