3v4l.org

run code in 300+ PHP versions simultaneously
<?php $secret = 'MySecretFromSiruMobile'; $fields = [ 'variant' => 'variant1', 'merchantId' => '123123', 'purchaseCountry' => 'FI', 'basePrice' => '12.34', 'taxClass' => 3, 'serviceGroup' => 3, 'customerFirstname' => '', 'customerLastname' => null, 'customerNumber' => '050 123 4567', ]; $fields = array_filter($fields); // Drop empty fields echo 'UNSORTED'; $signature = hash_hmac("sha512", implode(';', $fields), $secret); ksort($fields); // Sort by field name foreach ($fruits as $key => $val) { echo "$key = $val\n"; } echo 'SORTED'; $signature = hash_hmac("sha512", implode(';', $fields), $secret); echo $signature; ?>
Output for git.master, git.master_jit, rfc.property-hooks
UNSORTED Warning: Undefined variable $fruits in /in/j0hOL on line 22 Warning: foreach() argument must be of type array|object, null given in /in/j0hOL on line 22 SORTEDd47113a4c231e67970e57a3af3d149958ed70191e1f21226f6751e99361d08b2aa93cd9680222781bf0bd8c58dec3e463416e6f44159b3432dad7f8fefa10cb7

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.76 ms | 402 KiB | 8 Q