I am familiar with Java and at the moment I am teaching myself PHP. To prevent race conditions and deadlocks, Java uses the keyword ‘synchronized’.
From Oracle docs:
public synchronized void increment() {
c++;
}
I am using prepared statements within a separate class to access my database. I wish to avoid race conditions, deadlocks etc, but I cannot see how PHP handles this.
Does PHP have the equivalent to Java, and is it operating system specific? I am using Windows. What would best practices be?
No, your best bet is to use a "lock", in this case a file lock.
See https://www.php.net/flock for more information on file locking.