Where to put arrays with constant value that will be accessed many times?

后端 未结 6 1482
醉酒成梦
醉酒成梦 2021-01-03 18:06

I have some arrays storing the possible parameters for some 3D printer commands. I use this to check if the command is legal. I am confused about where I should put these ar

6条回答
  •  北海茫月
    2021-01-03 18:57

    If you are really looking into understanding how code performance can be measured, you should get familiar with Big-O notation.

    What is Big-O? Big-O cheat sheet

    Other than that, define them as protected class base properties for static data.

    class foo
    {
        protected static $bar = array();
    }
    

提交回复
热议问题