What is the purpose of constant() function?
Submitted by: AdministratorAs indicated by the name, this function will return the value of the constant. This is useful when you want to retrieve value of a constant, but you do not know its name, i.e. It is stored in a variable or returned by a function.
<?php
define("GlobalGuideline", 50);
echo GlobalGuideline;
echo constant("GlobalGuideline"); // same thing as the previous line
?>
Only scalar data (boolean, integer, float and string) can be contained in constants.
Submitted by:
<?php
define("GlobalGuideline", 50);
echo GlobalGuideline;
echo constant("GlobalGuideline"); // same thing as the previous line
?>
Only scalar data (boolean, integer, float and string) can be contained in constants.
Submitted by:
Read Online Sr. PHP Programmer Job Interview Questions And Answers
Top Sr. PHP Programmer Questions
☺ | What are the 3 scope levels available in PHP and how would you define them? |
☺ | What is the purpose of $_PHP_SELF variable in PHP? |
☺ | What is the purpse $_PHP_SELF variable? |
☺ | Can the value of a constant change during the script's execution? |
☺ | What is the purpose of _CLASS_ constant? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |