What will be the output of the following PHP code ?
<?php
function constant()
{
define("GREETING", "Welcome to Narnia");
echo greeting;
}
?>
<?php
function constant()
{
define("GREETING", "Welcome to Narnia");
echo greeting;
}
?>
A. Welcome to Narnia
B. greeting
C. GREETING
D. ERROR
Answer: Option D
Solution(By Examveda Team)
By default constants are case sensitive. Hence an error will arise.Related Questions on Functions
Which one of the following is the right way of defining a function in PHP?
A. function { function body }
B. data type functionName(parameters) { function body }
C. functionName(parameters) { function body }
D. function fumctionName(parameters) { function body }
A. Call By Value
B. Call By Reference
C. Default Argument Value
D. Type Hinting
Join The Discussion