progress encode function written in php
This php function mirrors the functionality provided by the progress 9.1d (and probably newer) "encode" function.
I based it directly on the c# version provided at https://github.com/pvginkel/ProgressEncode
It is Public Domain. Do as you wish with it.