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 ksort($fields); // Sort by field name $signature = hash_hmac("sha512", implode(';', $fields), $secret); echo $signature; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vtMtR
function name:  (null)
number of ops:  21
compiled vars:  !0 = $secret, !1 = $fields, !2 = $signature
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'MySecretFromSiruMobile'
    3     1        ASSIGN                                                   !1, <array>
   15     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   16     6        INIT_FCALL                                               'ksort'
          7        SEND_REF                                                 !1
          8        DO_ICALL                                                 
   17     9        INIT_FCALL                                               'hash_hmac'
         10        SEND_VAL                                                 'sha512'
         11        INIT_FCALL                                               'implode'
         12        SEND_VAL                                                 '%3B'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $8      
         15        SEND_VAR                                                 $8
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
   19    19        ECHO                                                     !2
   20    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.81 ms | 1395 KiB | 21 Q