3v4l.org

run code in 300+ PHP versions simultaneously
<?php $request = 'POST'; $url = '/1.0/wix/site-events'; $headers = array( 'x-wix-event-type' => '/provision/provision', 'x-wix-timestamp' => '2013-09-30T10:46:38.993Z', 'x-wix-signature' => 'BX1AQrO4IxNuwMIOhYiuiH0nrk-F8pamGgk6Oe7S82I', 'x-wix-application-id' => '1306dc69-eb2f-493d-fc98-f4e693829367', 'x-wix-instance-id'=> '1328a7fe-e451-8780-d201-0c5d9a1fc02b', 'x-wix-event-id'=> '2cdae256-750f-4cc8-bbde-b35018bf8ceb' ); $body = '{"instance-id":"1328a7fe-e451-8780-d201-0c5d9a1fc02b"}'; $key = "8bbb74b1-8864-47b3-804f-04925bf3ffba"; function concat($request, $url, $headers, $body) { $result = ''; $result .= $request; $result .= "\n"; $result .= $url; $result .= "\n"; ksort($headers); foreach ($headers as $header) { if ($header != 'x-wix-signature') { $result = $result . $header . ','; } } $result = $result . "\n" . $body; return $result; } $concat = concat($request, $url, $headers, $body); $encrypted = hash_hmac('sha256', $concat, $key); //$base64 = base64_encode($encrypted); echo "The computed signature is : " . $encrypted . "<br/>"; echo "The signature sent by Wix : " . $headers['x-wix-signature'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Sbcv
function name:  (null)
number of ops:  25
compiled vars:  !0 = $request, !1 = $url, !2 = $headers, !3 = $body, !4 = $key, !5 = $concat, !6 = $encrypted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'POST'
    3     1        ASSIGN                                                   !1, '%2F1.0%2Fwix%2Fsite-events'
    4     2        ASSIGN                                                   !2, <array>
   13     3        ASSIGN                                                   !3, '%7B%22instance-id%22%3A%221328a7fe-e451-8780-d201-0c5d9a1fc02b%22%7D'
   15     4        ASSIGN                                                   !4, '8bbb74b1-8864-47b3-804f-04925bf3ffba'
   37     5        INIT_FCALL                                               'concat'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !2
          9        SEND_VAR                                                 !3
         10        DO_FCALL                                      0  $12     
         11        ASSIGN                                                   !5, $12
   38    12        INIT_FCALL                                               'hash_hmac'
         13        SEND_VAL                                                 'sha256'
         14        SEND_VAR                                                 !5
         15        SEND_VAR                                                 !4
         16        DO_ICALL                                         $14     
         17        ASSIGN                                                   !6, $14
   41    18        CONCAT                                           ~16     'The+computed+signature+is+%3A+', !6
         19        CONCAT                                           ~17     ~16, '%3Cbr%2F%3E'
         20        ECHO                                                     ~17
   42    21        FETCH_DIM_R                                      ~18     !2, 'x-wix-signature'
         22        CONCAT                                           ~19     'The+signature+sent+by+Wix+%3A+', ~18
         23        ECHO                                                     ~19
         24      > RETURN                                                   1

Function concat:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 19
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/2Sbcv
function name:  concat
number of ops:  26
compiled vars:  !0 = $request, !1 = $url, !2 = $headers, !3 = $body, !4 = $result, !5 = $header
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   19     4        ASSIGN                                                   !4, ''
   20     5        ASSIGN_OP                                     8          !4, !0
   21     6        ASSIGN_OP                                     8          !4, '%0A'
   22     7        ASSIGN_OP                                     8          !4, !1
   23     8        ASSIGN_OP                                     8          !4, '%0A'
   24     9        INIT_FCALL                                               'ksort'
         10        SEND_REF                                                 !2
         11        DO_ICALL                                                 
   26    12      > FE_RESET_R                                       $12     !2, ->20
         13    > > FE_FETCH_R                                               $12, !5, ->20
   27    14    >   IS_NOT_EQUAL                                             !5, 'x-wix-signature'
         15      > JMPZ                                                     ~13, ->19
   28    16    >   CONCAT                                           ~14     !4, !5
         17        CONCAT                                           ~15     ~14, '%2C'
         18        ASSIGN                                                   !4, ~15
   26    19    > > JMP                                                      ->13
         20    >   FE_FREE                                                  $12
   32    21        CONCAT                                           ~17     !4, '%0A'
         22        CONCAT                                           ~18     ~17, !3
         23        ASSIGN                                                   !4, ~18
   34    24      > RETURN                                                   !4
   35    25*     > RETURN                                                   null

End of function concat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.73 ms | 1403 KiB | 18 Q