How To declare a final variable inside a Php class

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chandrakantk
Forum Newbie
Posts: 1
Joined: Tue Mar 25, 2008 12:22 am

How To declare a final variable inside a Php class

Post by chandrakantk »

Hi everyone,
I am new to PHP. Just wanted to know how to declare a final variable in php class.
It tried it in one of ide, it says that final is allowed for method only. Wanted to confirm this.


Thanks in Advance.

Chandrakant K
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: How To declare a final variable inside a Php class

Post by pickle »

I believe that is correct. You can define() a variable, or set it as static, if you want to not have it modified.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply