3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $parametersForSign = array( 'merchant-pos-id' => '185641', 'shop-name' => 'Název obchodu', 'total-amount' => '9.99', 'currency-code' => 'CZK', 'customer-language' => 'en', 'customer-email' => 'nemecoskar@gmail.com', ); $pk = 'db96e2ee781bb2045cc100db82f5944b'; function sigCalculate($parametersForSign, $privateKey) { ksort($parametersForSign); echo implode('', $parametersForSign) . "\n"; $str = implode('', $parametersForSign).$privateKey; echo $str . "\n"; return hash('sha256', $str); } echo sigCalculate($parametersForSign, $pk); ?>
based on 9mBLt
Output for 5.3.12 - 7.2.0
CZKnemecoskar@gmail.comen185641Název obchodu9.99 CZKnemecoskar@gmail.comen185641Název obchodu9.99db96e2ee781bb2045cc100db82f5944b 446a5b8a1239d3035c52968b17332c602fa933b5e1c913b6b7edcce6d2601dad