php - Do public static final class variables exist -


in jave can define public static final variable in class. there equivalent in php?

i'd following:

<?php  class myclass{      public final static $finalvariable = "something"; }  myclass::$finalvariable 

and not ever have worry $finalvariable changing , not having new instance every instantiation of myclass

from this page in php manual:

note: properties cannot declared final, classes , methods may declared final.

however, can use class constants described here.

your example this:

<?php  class myclass{     const finalvariable = "something"; }  myclass::finalvariable; ?> 

except of course finalvariable isn't appropriate name because it's not variable =).


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -