constant with a case-sensitive name | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

constant with a case-sensitive name

case-insensitive: Specifies whether the constant name should be case-insensitive. Default is false; The example below creates a constant with a case-sensitive name: <?php define("MSG", "Hi SoloLearners!"); echo MSG; ?> out put Hi SoloLearners! <?php define("MSG", " Hi SoloLearners!", true); echo msg; ?> out put Hi SoloLearners! Difference between these two not clear. Please make the concept clear in simple words. I referred to comment section but concept is not clear yet.

16th Sep 2018, 4:04 AM
kp kalia
kp kalia - avatar
1 Answer
+ 3
Case-sensitive means "Msg" and "MSG are not the same constant In first example: if u do "echo Msg" it will throw errors as u have declared case insensitive to false so u have to type the constant name exactly as u did it wil delcaring it while in second example case-insensitive is set to true so that's why u can also call it by using msg,Msg or MSg (doesnt matter)
16th Sep 2018, 4:31 AM
Rohit Singh
Rohit Singh - avatar