- hash_hmac: documentation ( source)
- strtoupper: documentation ( source)
- pack: documentation ( source)
<?php
$string = '511.483USD677144616IT Books. Qty: 217Books Online Inc.14www.sample.com1512345678901234589999999919pgw@mail.sample.com11--142003010515302116F2B2DD7E603A7ADA33https://www.sample.com/shop/reply';
$key = pack('H*', '00112233445566778899AABBCCDDEEFF');
$expected = 'FACC882CA67E109E409E3974DDEDA8AAB13A5E48';
$result = hash_hmac('sha1', $string, $key);
$result = strtoupper($result);
echo "Expected: $expected".PHP_EOL;
echo "Actual result: $result".PHP_EOL;