If you look at the documentation for the PHP crypt function, you see that it must be 2 digit. That is why it must be a sprintf("%02d"  there.