开发者

Use arrayaccess with static class

开发者 https://www.devze.com 2022-12-25 20:40 出处:网络
how I can use array access with my static class? F.e. I like to execute next script: class开发者_JS百科 A {

how I can use array access with my static class? F.e. I like to execute next script:

class开发者_JS百科 A {
   ...
}
A['p'] = 15;
echo isset(A['p']) ? A['p'] : 0;


The interface ArrayAccess only works for objects. There's nothing similar for static access.


You can make your class a singleton class then you can access it as static class

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号