Olivier Pons
Olivier Pons

Reputation: 15778

Php: are magic functions like magic constants: case insensitive?

On the official manual, you can read that magic constants are case-insensitive:

http://php.net/manual/en/language.constants.predefined.php

I've tested on __tostring() and __toString() and it's the same = case-insensitive.

There's no documentation about it.

Do you know if all magic functions are like magic constants = case insensitive?

Upvotes: 3

Views: 142

Answers (2)

hakre
hakre

Reputation: 197777

Note: Function names are case-insensitive, though it is usually good form to call functions as they appear in their declaration.

http://www.php.net/manual/functions.user-defined.php

This has to do how function names are stored in PHP internally. And for some languages (like Turkish) this can even lead to problems:


Variable names on the other hand are case-sensitive:

The variable name is case-sensitive.

http://php.net/manual/language.variables.basics.php

Upvotes: 3

Edson Medina
Edson Medina

Reputation: 10269

Yes, all functions on php are case-insensitive

Upvotes: 1

Related Questions