I have used SLIM framework in PHP to implement some REST APIs. All the REST API code is in index.php, where I am using a global variables. Each of the REST API function sets a global variable, and another child function reads it. Now the reason to choose global variable is to not pass this variable from one function to another, nothing else.
I wanted to know if there could be concurrency problem, where two REST requests interleave? Is it that a single object of this index.php
(OOPS) is instantiated for all the requests?
Is this how this sequence of event look like?
Request 1 -> Set global var to '10'
Request 2 -> Set global var to '9'
Request 1 -> Reads global var as '9'
Request 2 -> Reads global var as '9'