New to OOP in PHP
One of my functions requires another function to be executed before running. Is there a way I can check this?
Language-agnostic answer:
Keep a (static or global) "state" variable and set a flag within the prerequisite function when it's called. Check the flag in the dependent function to decide whether it's allowed to run.
2.1m questions
2.1m answers
60 comments
57.0k users