3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculate_signature($string, $private_key) { $hash = hash_hmac("sha1", $string, $private_key, true); $sig = rawurlencode(base64_encode($hash)); return $sig; } $api_key = "1234"; $private_key = "abcd"; $method = "GET"; $route = "forms"; $expires = strtotime("7:00"); $string_to_sign = sprintf("%s:%s:%s:%s", $api_key, $method, $route, $expires); $sig = calculate_signature($string_to_sign, $private_key); var_dump($sig); var_dump(strtotime("7:00")); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQEJF
function name:  (null)
number of ops:  31
compiled vars:  !0 = $api_key, !1 = $private_key, !2 = $method, !3 = $route, !4 = $expires, !5 = $string_to_sign, !6 = $sig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, '1234'
    9     1        ASSIGN                                                   !1, 'abcd'
   10     2        ASSIGN                                                   !2, 'GET'
   11     3        ASSIGN                                                   !3, 'forms'
   12     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAL                                                 '7%3A00'
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !4, $11
   13     8        INIT_FCALL                                               'sprintf'
          9        SEND_VAL                                                 '%25s%3A%25s%3A%25s%3A%25s'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !3
         13        SEND_VAR                                                 !4
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !5, $13
   14    16        INIT_FCALL                                               'calculate_signature'
         17        SEND_VAR                                                 !5
         18        SEND_VAR                                                 !1
         19        DO_FCALL                                      0  $15     
         20        ASSIGN                                                   !6, $15
   15    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !6
         23        DO_ICALL                                                 
   16    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'strtotime'
         26        SEND_VAL                                                 '7%3A00'
         27        DO_ICALL                                         $18     
         28        SEND_VAR                                                 $18
         29        DO_ICALL                                                 
   17    30      > RETURN                                                   1

Function calculate_signature:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQEJF
function name:  calculate_signature
number of ops:  18
compiled vars:  !0 = $string, !1 = $private_key, !2 = $hash, !3 = $sig
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'hash_hmac'
          3        SEND_VAL                                                 'sha1'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !2, $4
    4     9        INIT_FCALL                                               'rawurlencode'
         10        INIT_FCALL                                               'base64_encode'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                         $7      
         15        ASSIGN                                                   !3, $7
    5    16      > RETURN                                                   !3
    6    17*     > RETURN                                                   null

End of function calculate_signature

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
201.24 ms | 1403 KiB | 26 Q