answersLogoWhite

0


Best Answer

Generally, constant names are case sensitive in PHP.

But... you can do a trick. If you will be consistent and all constant name will be defines as uppercase, you can access them using a combination of constant() and strtoupper() functions. Look at this example:

?php

define(MY_CONSTANT, "HELLO");

echo constant(strtoupper(my_constant));

echo "
";

echo constant(strtoupper(My_Constant));

echo "
";

echo constant(strtoupper(my_CONSTANT));

?>

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How to make constant name case insensitive in PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Basic Math

How do you declare a constant?

use: define("GREETING", "Hello you.", true); 1st parameter is the name for your constant 2nd parameter is the value of that constant 3rd parameter is whether or not you want the constant to be case-insensitive. Default is case sensitive. http://php.net/manual/en/function.define.php


What makes a good password?

Use combination of letters, numbers, and special characters. Use both upper-case and lower-case letters. Do NOT use your own name, any family members' names, or pets's names, or for that matter any words Do NOT use birthdates, social security numbers, or any set of numbers that someone else might know. Make it something YOU can remember, but no one else can guess. If you have to change your password regularly, come up with a "base" password that is 2 characters shorter than a full password, then the last 2 characters can change from month to month.


Is there a number bigger than graham's number?

Yes, there is, but it has no name, for grahams number was and is still the largest number with a name. To make a number larger than grahams number, you just need to make grahams number 1, but it would not have a name because it is not official, and if you try to write it down, you could not, because all matter in the universe transformed into pen ink could not write it down. And if you tried to type it, your computer or whatever you where typing it on would fail.


What are the Error occurs when no checkbox is checked in PHP?

Suppose you have checkbox in HTML from and and you are calling that checkbox by name in php , In that case in you don't check and hit submit , You will get Undefined parameter 'name_of _checkbox' As Error.


How do you create table in sql?

create table "table-name" -> exclude the quotes when creating the tableafter this a message will come : table created(row_name data type(limit of characters),... )for example(name varchar2(20)).This will make a column(attribute) in your table with the name "name" and data type varchar with character limit of 20.you can further add more attributes in the same manner.to insert values in the table you need this:insert into "table name" values(123,qwew,wsd,2342)the data in the brackets above depends on the attributes of your table.and now you have created a simple table.you can update, delete, alter, drop the table.

Related questions

How do you declare a constant?

use: define("GREETING", "Hello you.", true); 1st parameter is the name for your constant 2nd parameter is the value of that constant 3rd parameter is whether or not you want the constant to be case-insensitive. Default is case sensitive. http://php.net/manual/en/function.define.php


Was Chief Knockahoma's dance after Atlanta Braves' home runs racially insensitive?

No, it was not insensitive; but some folks just needed a reason to complain. If it was so insensitive, why not have the Indians remove Chief Wahoo from their uniforms? Why do the Red Skins get to keep their football name?


What ethnically insensitive name did Joyce call her lover on Hill Street Blues?

Pizzaman


What is the birth name of Benjamin Constant?

Benjamin Constant's birth name is de Rebecque, Benjamin Henri Constant.


What is the name of a value that does not change?

A "constant"


What is the birth name of Aina Constant?

Aina Constant's birth name is Aina Konstant.


What is the birth name of Charles Constant?

Charles Constant's birth name is Charles Constantino.


What was final jeopardy for february 16 2012?

PEOPLE IN HISTORYThe name of this assassin is Latin for heavy, dull, insensitive, oafishBrutus


What are different NAME of constant r?

R may be the Rydberg constant or the gas constant.


What was the final Jeopardy category and answer and question for February 16 2012?

PEOPLE IN HISTORYThe name of this assassin is Latin for heavy, dull, insensitive, oafishBrutus


Name two things you need to keep the same to help make tests fair in science?

Some ways which you make tests fair: -Try keep the temperature constant -Try to make as many conditions apart from the IV (the thing your changing) the same -Repeat 3 times in case of anomalies which don't show how the test should have turned out


What type of data has another name for constant?

a any other name of this tipe of data