0

Constants that are Case-Sensitive

In the example, it gives me an error for an output that I understand. When I put in the true value of MSG it gives me another error instead of putting in the output "Hello SoloLearners!" Now my question is why that is? It keeps saying that it is: Declaration of case-insensitive constants is deprecated in ./Playground/file0.php on line 2 Hi SoloLearners! I am new to PHP so any explanation would be very helpful. Thank you!

9th Nov 2020, 7:43 AM
Nikkolet Ashby
Nikkolet Ashby - avatar
1 Respuesta
+ 4
That's because since version 7.3 of php, the third optional parameter used in the declaration of constants using define (); is obsolete. It was used to make your variable case-insensitive. for example: define ("VARIABLE", "value", true); echo VARIABLE; It generates that warning that you mention, so true must be removed. Another way to declare a constant is with the const keyword: const VARIABLE = "value"; With this other way you don't have to worry about the obsolete parameter.
9th Nov 2020, 8:34 AM
Mariano Fregosi
Mariano Fregosi - avatar