3v4l.org

run code in 300+ PHP versions simultaneously
<?php function amx_authorization_header($id,$key,$url,$method='GET',$body=null) { $url=strtolower(urlencode($url)); $method=strtoupper($method); $content=empty($body)?'':base64_encode(md5($body,true)); $time=1508797800; $nonce=10; $data=implode('',[$id,$method,$url,$time,$nonce,$content]); $secret=base64_decode($key); $signature=base64_encode(hash_hmac('sha256',$data,$secret,true)); //print($data); return 'Authorization: amx'.implode(':',[$id,$signature,$nonce,$time]); } amx_authorization_header('cde','abc' ,'https://broker.negociecoins.com.br/tradeapi/v1/user/balance'); print(amx_authorization_header('cde','abc' ,'https://broker.negociecoins.com.br/tradeapi/v1/user/balance'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mjhmu
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'amx_authorization_header'
          1        SEND_VAL                                                 'cde'
          2        SEND_VAL                                                 'abc'
          3        SEND_VAL                                                 'https%3A%2F%2Fbroker.negociecoins.com.br%2Ftradeapi%2Fv1%2Fuser%2Fbalance'
          4        DO_FCALL                                      0          
   18     5        INIT_FCALL                                               'amx_authorization_header'
          6        SEND_VAL                                                 'cde'
          7        SEND_VAL                                                 'abc'
          8        SEND_VAL                                                 'https%3A%2F%2Fbroker.negociecoins.com.br%2Ftradeapi%2Fv1%2Fuser%2Fbalance'
          9        DO_FCALL                                      0  $1      
         10        ECHO                                                     $1
         11      > RETURN                                                   1

Function amx_authorization_header:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mjhmu
function name:  amx_authorization_header
number of ops:  67
compiled vars:  !0 = $id, !1 = $key, !2 = $url, !3 = $method, !4 = $body, !5 = $content, !6 = $time, !7 = $nonce, !8 = $data, !9 = $secret, !10 = $signature
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      'GET'
          4        RECV_INIT                                        !4      null
    4     5        INIT_FCALL                                               'strtolower'
          6        INIT_FCALL                                               'urlencode'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $11     
          9        SEND_VAR                                                 $11
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !2, $12
    5    12        INIT_FCALL                                               'strtoupper'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $14     
         15        ASSIGN                                                   !3, $14
    6    16        ISSET_ISEMPTY_CV                                         !4
         17      > JMPZ                                                     ~16, ->20
         18    >   QM_ASSIGN                                        ~17     ''
         19      > JMP                                                      ->28
         20    >   INIT_FCALL                                               'base64_encode'
         21        INIT_FCALL                                               'md5'
         22        SEND_VAR                                                 !4
         23        SEND_VAL                                                 <true>
         24        DO_ICALL                                         $18     
         25        SEND_VAR                                                 $18
         26        DO_ICALL                                         $19     
         27        QM_ASSIGN                                        ~17     $19
         28    >   ASSIGN                                                   !5, ~17
    7    29        ASSIGN                                                   !6, 1508797800
    8    30        ASSIGN                                                   !7, 10
    9    31        INIT_FCALL                                               'implode'
         32        SEND_VAL                                                 ''
         33        INIT_ARRAY                                       ~23     !0
         34        ADD_ARRAY_ELEMENT                                ~23     !3
         35        ADD_ARRAY_ELEMENT                                ~23     !2
         36        ADD_ARRAY_ELEMENT                                ~23     !6
         37        ADD_ARRAY_ELEMENT                                ~23     !7
         38        ADD_ARRAY_ELEMENT                                ~23     !5
         39        SEND_VAL                                                 ~23
         40        DO_ICALL                                         $24     
         41        ASSIGN                                                   !8, $24
   10    42        INIT_FCALL                                               'base64_decode'
         43        SEND_VAR                                                 !1
         44        DO_ICALL                                         $26     
         45        ASSIGN                                                   !9, $26
   11    46        INIT_FCALL                                               'base64_encode'
         47        INIT_FCALL                                               'hash_hmac'
         48        SEND_VAL                                                 'sha256'
         49        SEND_VAR                                                 !8
         50        SEND_VAR                                                 !9
         51        SEND_VAL                                                 <true>
         52        DO_ICALL                                         $28     
         53        SEND_VAR                                                 $28
         54        DO_ICALL                                         $29     
         55        ASSIGN                                                   !10, $29
   14    56        INIT_FCALL                                               'implode'
         57        SEND_VAL                                                 '%3A'
         58        INIT_ARRAY                                       ~31     !0
         59        ADD_ARRAY_ELEMENT                                ~31     !10
         60        ADD_ARRAY_ELEMENT                                ~31     !7
         61        ADD_ARRAY_ELEMENT                                ~31     !6
         62        SEND_VAL                                                 ~31
         63        DO_ICALL                                         $32     
         64        CONCAT                                           ~33     'Authorization%3A+amx', $32
         65      > RETURN                                                   ~33
   15    66*     > RETURN                                                   null

End of function amx_authorization_header

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.64 ms | 1403 KiB | 31 Q