Topic: Code repetition

There are many instances of code repetition found in PunBB. Are you guys not aware of it or what? Like in changeset 1540 (http://dev.punbb.org/changeset/1540), you can do:

$basename = $pun_config['o_avatars_dir'].'/'.$id;
foreach(array('gif', 'jpg', 'png') as $ext) {
 $file = "basename.$ext";
 if(file_exists($file)) {
  @unlink($file);
 }
}

Oh wait, I forgot you guys don't use foreach()

Re: Code repetition

FYI, I'm not sure whether you meant it to or not, but your post comes off sounding very rude.

I personally don't see any particular advantage to doing things that way in the specific instance you're mentioning (especially since your example actually takes more lines then what is required otherwise). What are the advantages?

Re: Code repetition

Out of curiosity, why you don't use foreach?

Re: Code repetition

OP was exaggerating. There's plenty of foreach in the code, when it makes sense to use it.