3v4l.org

run code in 300+ PHP versions simultaneously
<?php $request = 'POST'; $url = '/1.0/wix/site-events'; $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); $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/2qiSo
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>
   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 = 20, Position 2 = 42
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 42
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 41
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 41
Branch analysis from position: 25
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/2qiSo
function name:  concat
number of ops:  51
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                                                 
   27    18        ASSIGN                                                   !5, <true>
   28    19      > FE_RESET_R                                       $16     !2, ->42
         20    > > FE_FETCH_R                                               $16, !6, ->42
   29    21    >   IS_NOT_EQUAL                                     ~17     !6, 'X-Wix-Signature'
         22      > JMPZ_EX                                          ~17     ~17, ->25
         23    >   BOOL                                             ~18     !5
         24        BOOL                                             ~17     ~18
         25    > > JMPZ                                                     ~17, ->33
   30    26    >   INIT_FCALL                                               'trim'
         27        SEND_VAR                                                 !6
         28        DO_ICALL                                         $19     
         29        CONCAT                                           ~20     !4, $19
         30        ASSIGN                                                   !4, ~20
   31    31        ASSIGN                                                   !5, <false>
         32      > JMP                                                      ->41
   32    33    >   IS_NOT_EQUAL                                             !6, 'X-Wix-Signature'
         34      > JMPZ                                                     ~23, ->41
   33    35    >   CONCAT                                           ~24     !4, '%2C'
         36        INIT_FCALL                                               'trim'
         37        SEND_VAR                                                 !6
         38        DO_ICALL                                         $25     
         39        CONCAT                                           ~26     ~24, $25
         40        ASSIGN                                                   !4, ~26
   28    41    > > JMP                                                      ->20
         42    >   FE_FREE                                                  $16
   37    43        CONCAT                                           ~28     !4, '%0A'
         44        INIT_FCALL                                               'trim'
         45        SEND_VAR                                                 !3
         46        DO_ICALL                                         $29     
         47        CONCAT                                           ~30     ~28, $29
         48        ASSIGN                                                   !4, ~30
   39    49      > RETURN                                                   !4
   40    50*     > RETURN                                                   null

End of function concat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.3 ms | 1407 KiB | 20 Q