PHP: Reduce duplicate rebuilds.