3v4l.org

run code in 300+ PHP versions simultaneously
<?php $request = 'POST'; $url = ''; $headers = array( 'X-Wix-Signature' => '3elavUOF0-I1_7tGz2XZKs_HSlrygsMiblpNFPKv3Ik', "X-Wix-Instance-Id" => "132fc751-9325-63d3-a605-f74e0c25192a", "X-Wix-Event-Id" => "da390885-e72f-4a93-be7f-a90220bac5c7", "X-Wix-Event-Type" => "/provision/provision", "X-Wix-Timestamp" => "2013-10-23T15:39:34.462Z", "X-Wix-Application-Id" => "132fbf95-d58e-f9ed-86e8-48b76f901d91" ); //$body = "{\n\t\"instance-id\": \"1328a7fe-e451-8780-d201-0c5d9a1fc02b\"\n}"; $body = '{"instance-id":"132fc751-9325-63d3-a605-f74e0c25192a"}'; $key = "97cfac6e-b061-4007-a03e-eb4bc199e620"; function concat($request, $url, $headers, $body) { $result = ''; $result .= trim($request); $result .= "\n"; $result .= trim($url); $result .= "\n"; ksort($headers);var_dump($headers); $first = true; foreach ($headers as $header) { if ($header != 'X-Wix-Signature' && $first == true) { $result = $result . trim($header); $first = false; } else if ($header != 'X-Wix-Signature') { $result = $result . ',' . trim($header); } } $result = $result . "\n" . trim($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 . "\n"; 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/6uAoE
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, ''
    4     2        ASSIGN                                                   !2, <array>
   14     3        ASSIGN                                                   !3, '%7B%22instance-id%22%3A%22132fc751-9325-63d3-a605-f74e0c25192a%22%7D'
   16     4        ASSIGN                                                   !4, '97cfac6e-b061-4007-a03e-eb4bc199e620'
   42     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
   43    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
   46    18        CONCAT                                           ~16     'The+computed+signature+is+%3A+', !6
         19        CONCAT                                           ~17     ~16, '%0A'
         20        ECHO                                                     ~17
   47    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 = 23, Position 2 = 45
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 45
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 36
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 44
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 44
Branch analysis from position: 28
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
filename:       /in/6uAoE
function name:  concat
number of ops:  54
compiled vars:  !0 = $request, !1 = $url, !2 = $headers, !3 = $body, !4 = $result, !5 = $first, !6 = $header
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   20     4        ASSIGN                                                   !4, ''
   21     5        INIT_FCALL                                               'trim'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $8      
          8        ASSIGN_OP                                     8          !4, $8
   22     9        ASSIGN_OP                                     8          !4, '%0A'
   23    10        INIT_FCALL                                               'trim'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $11     
         13        ASSIGN_OP                                     8          !4, $11
   24    14        ASSIGN_OP                                     8          !4, '%0A'
   25    15        INIT_FCALL                                               'ksort'
         16        SEND_REF                                                 !2
         17        DO_ICALL                                                 
         18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
   27    21        ASSIGN                                                   !5, <true>
   28    22      > FE_RESET_R                                       $17     !2, ->45
         23    > > FE_FETCH_R                                               $17, !6, ->45
   29    24    >   IS_NOT_EQUAL                                     ~18     !6, 'X-Wix-Signature'
         25      > JMPZ_EX                                          ~18     ~18, ->28
         26    >   BOOL                                             ~19     !5
         27        BOOL                                             ~18     ~19
         28    > > JMPZ                                                     ~18, ->36
   30    29    >   INIT_FCALL                                               'trim'
         30        SEND_VAR                                                 !6
         31        DO_ICALL                                         $20     
         32        CONCAT                                           ~21     !4, $20
         33        ASSIGN                                                   !4, ~21
   31    34        ASSIGN                                                   !5, <false>
         35      > JMP                                                      ->44
   32    36    >   IS_NOT_EQUAL                                             !6, 'X-Wix-Signature'
         37      > JMPZ                                                     ~24, ->44
   33    38    >   CONCAT                                           ~25     !4, '%2C'
         39        INIT_FCALL                                               'trim'
         40        SEND_VAR                                                 !6
         41        DO_ICALL                                         $26     
         42        CONCAT                                           ~27     ~25, $26
         43        ASSIGN                                                   !4, ~27
   28    44    > > JMP                                                      ->23
         45    >   FE_FREE                                                  $17
   37    46        CONCAT                                           ~29     !4, '%0A'
         47        INIT_FCALL                                               'trim'
         48        SEND_VAR                                                 !3
         49        DO_ICALL                                         $30     
         50        CONCAT                                           ~31     ~29, $30
         51        ASSIGN                                                   !4, ~31
   39    52      > RETURN                                                   !4
   40    53*     > RETURN                                                   null

End of function concat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.66 ms | 1407 KiB | 22 Q