3v4l.org

run code in 300+ PHP versions simultaneously
<?php function signRequest($client_id, $method, $resource, $secret, $version) { $param = array( 'client' => $client_id, 'method' => strtoupper($method), 'nonce' => bin2hex(openssl_random_pseudo_bytes(10)), 'resource' => $resource, 'timestamp' => time(), 'version' => $version ); ksort($param); $param['signature'] = hash_hmac('sha1', http_build_query($param, '', '&'), $secret); return http_build_query($param, '', '&'); } echo signRequest('3deb5a52efad78b6f02a763f2f525ffdf6d6b1d9', 'POST', 'https://api.veridu.com/0.3/session/write', 'secret', '0.3');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/soGsE
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'signrequest'
          1        SEND_VAL                                                 '3deb5a52efad78b6f02a763f2f525ffdf6d6b1d9'
          2        SEND_VAL                                                 'POST'
          3        SEND_VAL                                                 'https%3A%2F%2Fapi.veridu.com%2F0.3%2Fsession%2Fwrite'
          4        SEND_VAL                                                 'secret'
          5        SEND_VAL                                                 '0.3'
          6        DO_FCALL                                      0  $0      
          7        ECHO                                                     $0
          8      > RETURN                                                   1

Function signrequest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/soGsE
function name:  signRequest
number of ops:  45
compiled vars:  !0 = $client_id, !1 = $method, !2 = $resource, !3 = $secret, !4 = $version, !5 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
    4     5        INIT_ARRAY                                       ~6      !0, 'client'
    5     6        INIT_FCALL                                               'strtoupper'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $7      
          9        ADD_ARRAY_ELEMENT                                ~6      $7, 'method'
    6    10        INIT_FCALL                                               'bin2hex'
         11        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
         12        SEND_VAL_EX                                              10
         13        DO_FCALL                                      0  $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                         $9      
         16        ADD_ARRAY_ELEMENT                                ~6      $9, 'nonce'
    7    17        ADD_ARRAY_ELEMENT                                ~6      !2, 'resource'
    8    18        INIT_FCALL                                               'time'
         19        DO_ICALL                                         $10     
         20        ADD_ARRAY_ELEMENT                                ~6      $10, 'timestamp'
    9    21        ADD_ARRAY_ELEMENT                                ~6      !4, 'version'
    3    22        ASSIGN                                                   !5, ~6
   11    23        INIT_FCALL                                               'ksort'
         24        SEND_REF                                                 !5
         25        DO_ICALL                                                 
   12    26        INIT_FCALL                                               'hash_hmac'
         27        SEND_VAL                                                 'sha1'
         28        INIT_FCALL                                               'http_build_query'
         29        SEND_VAR                                                 !5
         30        SEND_VAL                                                 ''
         31        SEND_VAL                                                 '%26'
         32        DO_ICALL                                         $14     
         33        SEND_VAR                                                 $14
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                         $15     
         36        ASSIGN_DIM                                               !5, 'signature'
         37        OP_DATA                                                  $15
   13    38        INIT_FCALL                                               'http_build_query'
         39        SEND_VAR                                                 !5
         40        SEND_VAL                                                 ''
         41        SEND_VAL                                                 '%26'
         42        DO_ICALL                                         $16     
         43      > RETURN                                                   $16
   14    44*     > RETURN                                                   null

End of function signrequest

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.41 ms | 1403 KiB | 26 Q