3v4l.org

run code in 300+ PHP versions simultaneously
<?php function signRequest($domain, $method, $public_key, $private_key, $data=array()){ $data = array_filter($data); // Normalise data if(array_key_exists('request_timestamp', $data)) { $data['request_timestamp'] = (int) $data['request_timestamp']; } ksort($data); $data = json_encode($data); $buffer = array($domain, $method, $data, $public_key); $buffer_str = implode(":", $buffer); return hash_hmac('sha256', $buffer_str, $private_key); } //echo signRequest("neom.dev", "products", "c7912e9a71d7208f", "767f791f93a272d3f4554116", []); echo time();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DA6OH
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'time'
          1        DO_ICALL                                         $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function signrequest:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/DA6OH
function name:  signRequest
number of ops:  39
compiled vars:  !0 = $domain, !1 = $method, !2 = $public_key, !3 = $private_key, !4 = $data, !5 = $buffer, !6 = $buffer_str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV_INIT                                        !4      <array>
    4     5        INIT_FCALL                                               'array_filter'
          6        SEND_VAR                                                 !4
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !4, $7
    5     9        ARRAY_KEY_EXISTS                                         'request_timestamp', !4
         10      > JMPZ                                                     ~9, ->15
    7    11    >   FETCH_DIM_R                                      ~11     !4, 'request_timestamp'
         12        CAST                                          4  ~12     ~11
         13        ASSIGN_DIM                                               !4, 'request_timestamp'
         14        OP_DATA                                                  ~12
    9    15    >   INIT_FCALL                                               'ksort'
         16        SEND_REF                                                 !4
         17        DO_ICALL                                                 
   10    18        INIT_FCALL                                               'json_encode'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                         $14     
         21        ASSIGN                                                   !4, $14
   11    22        INIT_ARRAY                                       ~16     !0
         23        ADD_ARRAY_ELEMENT                                ~16     !1
         24        ADD_ARRAY_ELEMENT                                ~16     !4
         25        ADD_ARRAY_ELEMENT                                ~16     !2
         26        ASSIGN                                                   !5, ~16
   12    27        INIT_FCALL                                               'implode'
         28        SEND_VAL                                                 '%3A'
         29        SEND_VAR                                                 !5
         30        DO_ICALL                                         $18     
         31        ASSIGN                                                   !6, $18
   14    32        INIT_FCALL                                               'hash_hmac'
         33        SEND_VAL                                                 'sha256'
         34        SEND_VAR                                                 !6
         35        SEND_VAR                                                 !3
         36        DO_ICALL                                         $20     
         37      > RETURN                                                   $20
   15    38*     > RETURN                                                   null

End of function signrequest

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.18 ms | 1400 KiB | 25 Q