Experts,

I do not understand this atall.
Here:
https://www.tutorialspoint.com/php/php_constants.htm

It says:
"PHP Magic constants
PHP provides a large number of predefined constants to any script which it runs.

There are five magical constants that change depending on where they are used. For example, the value of LINE depends on the line that it's used on in your script. [b]These special constants are [u]case-insensitive[/u] and are as follows[/b] −".

CLASS

The class name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the class name as it was declared [b]u[/u][/b]. In PHP 4 its value is always lowercased.

METHOD

The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared [b]u[/u][/b].

Seems like contradiction to me. Firs they say case-insensitive. Then in their 2 examples they mention they are case-sensitive. What is going on ? I need some good explanation with a min of 2 good examples to understand any of this.

Recommended Answers

All 5 Replies

I'm not a php user, but just reading what you posted...
these constants have a name and value (which depends on the context).
The name appears to be case-insensitive (ie LINE Line line are all valid), but the values follow case-sensitive rules as above.
Maybe a php buff can confirm or correct that.

I always cap them because then you can detect them in your code a LOT easier! Also, I am not sure, but they may need to be all caps anyway. I'd have to refer to the reference documentation to be sure.

I think you are right Jamie. Others tell me this also. I suspected as such.

Thanks!

I got my wires crossed with this subject and thread. It can be closed. The tutorial was talking about case sensitive in magic quote names but their values being case insensitive. I didn't understand that and thought they were saying at one place the values are case sensitive and on another place values are case in-sensitive. But I had a hunch what they were saying and needed more experienced guys to confirm it.

Thank you all!

This thread can now be closed.

Member Avatar for diafol

Please marked as solved. You are the only one that can do this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.