3v4l.org

run code in 300+ PHP versions simultaneously
<?php $parametersForSign = array( 'merchant-pos-id' => '185641', 'shop-name' => 'Název obchodu', 'total-amount' => '10.00', 'currency-code' => 'CZK', 'customer-language' => 'en', 'store-card'=> 'true', '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); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J04JU
function name:  (null)
number of ops:  8
compiled vars:  !0 = $parametersForSign, !1 = $pk
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, 'db96e2ee781bb2045cc100db82f5944b'
   20     2        INIT_FCALL                                               'sigcalculate'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
   21     7      > RETURN                                                   1

Function sigcalculate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J04JU
function name:  sigCalculate
number of ops:  25
compiled vars:  !0 = $parametersForSign, !1 = $privateKey, !2 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_FCALL                                               'ksort'
          3        SEND_REF                                                 !0
          4        DO_ICALL                                                 
   15     5        INIT_FCALL                                               'implode'
          6        SEND_VAL                                                 ''
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $4      
          9        CONCAT                                           ~5      $4, '%0A'
         10        ECHO                                                     ~5
   16    11        INIT_FCALL                                               'implode'
         12        SEND_VAL                                                 ''
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $6      
         15        CONCAT                                           ~7      $6, !1
         16        ASSIGN                                                   !2, ~7
   17    17        CONCAT                                           ~9      !2, '%0A'
         18        ECHO                                                     ~9
   18    19        INIT_FCALL                                               'hash'
         20        SEND_VAL                                                 'sha256'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $10     
         23      > RETURN                                                   $10
   19    24*     > RETURN                                                   null

End of function sigcalculate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.15 ms | 1390 KiB | 20 Q