I need to load data as an array into memory in PHP.but in PHP if I write $ array = array ("1", "2"); in test.php, then this $ array variable is initialized every time the user requests. If we request test.php 100 times by clicking the update reset button 100 times, then this $ array variable will be executed 100 times.
but I need to execute the $ array variable only once for the first time request, and the subsequent test.php request should not execute the $ array variable. But use only this memory location. How can I do this in PHP.
but in JAVA SEVRVLET is easy to execute, just write the $ array variable at a time when you run the init () method of the servlet lifecycle method and then request that servlet not run the init () method, but the service () method, but service () always uses this Array location $ array.
all I want to initialize the $ array variable once, but use this memory object from a subsequent request in PHP. Is there any possibility in PHP?
msaif source
share