Ah.
The beaut of self-replying.
For the archive: This works:
// On linux systems, unpack("H*", pack("L*", <value>)) returns differently than on Windows.
// This can be used instead of unpack/pack to get the value we need.
function SafeDecHexReverseEndian($value)
{
$result = "";
$hex = dechex($this -> ReduceTo32Bit($value));
$len = strlen($hex);
while($len < 8)
{
$hex = "0$hex";
$len++;
}
$bytes = str_split($hex, 2);
$bytes = unpack("H*", pack("L*", $value));
for($i = 3; $i >= 0; $i--)
$result .= $bytes[$i];
return $result;
}