Synchronized function calls for PHP