I am working with a PHP project where I rename files, sometimes it takes time for these files to rename. I want to detect when they have finished renaming. I know in Objective C there are blocks that will perform a task and on completion give the ability to perform another task.
Here is an example that is a uiview animation:
[UIView animateWithDuration:kAnimationDuration delay:0 options:1 << 1 animations:^{
myImageView.alpha = 0;
} completion:^(BOOL finished){
[myImageView removeFromSuperview];
}];
My question is there something similar in php so that I can detect when a file has finished renaming.
I have done this with if statements, but I feel it's bad style:
if(rename($oldName, $newName)){
//finished renaming
}