3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculate_signature($method, $token, $secret) { $method = str_replace('/', '-', trim($method, '/')); $query = new HttpQueryString(false); $query->set(array('method' => $method, 'token' => $token)); return hash_hmac('md5', $query->toString(), $secret); } echo calculate_signature('/films/novelty', '2794b4ee27b3ec6da253f8f2b4307254cb47ef78', 'p4nXucLRlrvlccSe');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g1iNY
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'calculate_signature'
          1        SEND_VAL                                                 '%2Ffilms%2Fnovelty'
          2        SEND_VAL                                                 '2794b4ee27b3ec6da253f8f2b4307254cb47ef78'
          3        SEND_VAL                                                 'p4nXucLRlrvlccSe'
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
          6      > RETURN                                                   1

Function calculate_signature:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g1iNY
function name:  calculate_signature
number of ops:  31
compiled vars:  !0 = $method, !1 = $token, !2 = $secret, !3 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    5     3        INIT_FCALL                                               'str_replace'
          4        SEND_VAL                                                 '%2F'
          5        SEND_VAL                                                 '-'
          6        INIT_FCALL                                               'trim'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 '%2F'
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                         $5      
         12        ASSIGN                                                   !0, $5
    7    13        NEW                                              $7      'HttpQueryString'
         14        SEND_VAL_EX                                              <false>
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !3, $7
    8    17        INIT_METHOD_CALL                                         !3, 'set'
         18        INIT_ARRAY                                       ~10     !0, 'method'
         19        ADD_ARRAY_ELEMENT                                ~10     !1, 'token'
         20        SEND_VAL_EX                                              ~10
         21        DO_FCALL                                      0          
    9    22        INIT_FCALL                                               'hash_hmac'
         23        SEND_VAL                                                 'md5'
         24        INIT_METHOD_CALL                                         !3, 'toString'
         25        DO_FCALL                                      0  $12     
         26        SEND_VAR                                                 $12
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $13     
         29      > RETURN                                                   $13
   10    30*     > RETURN                                                   null

End of function calculate_signature

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.41 ms | 1403 KiB | 20 Q