views:

114

answers:

2

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?

+12  A: 

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.

Pekka
+2  A: 

Variable names are case-sensitive.

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

initall