+ 2
Can someone body tell my what is the difference between false and true constant?
8 Réponses
+ 3
the last parameter in "define" says if it case sensitive or not. It means it's case sensitive for "false" (and this is the default, if you don't put this parameter) and if "true" its insensitive.
example:
<?php
define ("MAX", 10, true);
echo MAX; //output: 10
echo mAx; //output: 10
echo max; //output: 10
gt;
+ 2
You should use "false" if you want your constant's name to be case sensitive over your code. For example, this code will generate and error:
define("MSG", "Hi SoloLearners!",false);
echo Msg;
If you don't mind how you will recall the constant's name in your code in terms of case sentiviness, you can use "true" when you are defining your constant in the define function. For example, this code will not generate any error and will show "Hi SoloLearners!" three times (without the quotations marks)
define("MSG", "Hi SoloLearners!",true);
echo Msg;
echo MSG;
echo msg;
By the way, "false" is the default value and if you omitted in the define function this is what you're going to get.
+ 1
hi bro. true: case-sensetive is off. false:case-sensetive is on.
+ 1
true is on, and false is off
+ 1
True constant allows you to enter any format that you want to choose capital or small letter for value. Its by default false. When it's false u have to use the same name as a value in term of (capital or small) letter format
+ 1
You can consider TRUE as 1 and FALSE as 0
0
They are pre defined constants that could be used to check and assign a true or a false value of a variable. you will use it a lot.
- 1
if you mean difference between case sensitivity. when this property is true then varx and varX are two different variables for php. when the property is false then you can type vary or varY there is no difference for php.