Quantcast
Channel: How to initialize static variables - Stack Overflow
Viewing all articles
Browse latest Browse all 11

Answer by Buffalo for How to initialize static variables

$
0
0

In PHP 7.0.1, I was able to define this:

public static $kIdsByActions = array(  MyClass1::kAction => 0,  MyClass2::kAction => 1);

And then use it like this:

MyClass::$kIdsByActions[$this->mAction];

Viewing all articles
Browse latest Browse all 11

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>