wyc
wyc

Reputation: 55263

Why are some variables in PHP written in uppercase?

Why does some code in PHP have to be written in uppercase?

For instance:

if(isSet($_GET['lang']))
$lang = $_GET['lang'];
$_SESSION['lang'] = $lang;

Do they work if I write them in lowercase?

Upvotes: 2

Views: 3939

Answers (2)

initall
initall

Reputation: 2385

Variable names are case-sensitive.

Some you mention have to be written uppercase by convention, the superglobal arrays like _GET, _SESSION et al.

Upvotes: 2

Pekka
Pekka

Reputation: 449395

If you refer to the function names: Yes, those are case insensitive. You can use IsSET(), IsSeT(), isSET() to your heart's content.

If you refer to the variables $_GET etc.: No, variable names in PHP are case sensitive:

Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.

Upvotes: 15

Related Questions