문제

I want to create a file-static variable in PHP. How can I do this or what should I use instead?

Edit:

I'm basically wanting to create a file-scope static variable, similar to what is available in C/C++.

도움이 되었습니까?

해결책 2

After further investigation, it seems like the easiest solution is to just use a class which wraps the functions. The only downside is you have to use the prefix when calling: Container::Func(); This could be solved with an additional wrapper for each function, but this isn't as clean of a solution.

다른 팁

You can take a look at namespaces. Available only in PHP >=5.3 http://www.php.net/manual/en/language.namespaces.rationale.php

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top