And here I thought it might've been a bug in your implementation.
If you knew array_pad was flawed, you should've mentioned it.
I'm sure I wouldn't have been the first to think that the reference implementation would be correct and could be used to verify results.
MJDsays "you can't just make shit up and expect the computer to know what you mean, retardo!"