It appears to work fine, except when the name of the zip file already exists (from an earlier time).
For example, if $pid is 3512 and file zips/z3512.zip already exists, it does not overwrite the existing file, it just changes the date, but the content is as before, NOT the new content. I could of course write code to insure a unique name, based on what is already there, but why is that necessary.
FYI, I tried php unlink on the file, no dice, same thing happens.