What will happen if same static method is called by two parallel threads?
Will it make one thread waiting or can two parallel instances of a static method exists?
Assume function don't use member variables and only use local variables.
Example:
<?php
public class ClassName{
public static function doStuff(){
// Function code goes here
}
}
?>
Assume this function is called by GET request
to the server. Then if two users send a call to the URL exactly at same time, then what will happen?
See Confirmation that PHP static variables do not persist across requests for the information you need.
Standard PHP does not do any locking or waiting. It will just run the method and the 2 seperate request do not known of each other and they can't access each others memory(In the given case).
This is a race condition. It depends which request gets processed first. A http request is handled by a webserver and the webserver spawns a php process to process the php script.