3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Signature { private $salt = '00f40f6dd20548c514e62b666ebb9e98'; public function setSalt($salt) { $this->salt = $salt; } public function generate($orderNumber, $orderAmount) { if( !empty($orderNumber) && !empty($orderAmount) && isset($this->salt) ) { $orderId = htmlentities($orderNumber); $orderAmount = htmlentities($orderAmount); $amountSum = floatval(str_replace(array(',', ' ', "'", '`'), array('.', '', '', ''), $orderAmount)) * 100; $salt = $this->salt; $signature = md5($orderId.'&'.$orderAmount.'&'.$salt); return $signature; } else { throw new Exception("Ошибка: Не верно переданны параметры для генерации сигнатуры", 1); return 0; } } } $signature = new Signature; $orderNumber = 1; $orderAmount = 200; $key = $signature->generate($orderNumber, $orderAmount); echo 'http://mirusoft.ru/include/payments/aq.php?Signature='.$key.'&Order_ID='.$orderNumber.'&Subtotal='.$orderAmount.'&FirstName=Ivan&LastName=Ivanov&Email=ivan@ivanov.ru&Phone=1234567890';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BFsUI
function name:  (null)
number of ops:  18
compiled vars:  !0 = $signature, !1 = $orderNumber, !2 = $orderAmount, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $4      'Signature'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   27     3        ASSIGN                                                   !1, 1
   28     4        ASSIGN                                                   !2, 200
   29     5        INIT_METHOD_CALL                                         !0, 'generate'
          6        SEND_VAR_EX                                              !1
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0  $9      
          9        ASSIGN                                                   !3, $9
   31    10        CONCAT                                           ~11     'http%3A%2F%2Fmirusoft.ru%2Finclude%2Fpayments%2Faq.php%3FSignature%3D', !3
         11        CONCAT                                           ~12     ~11, '%26Order_ID%3D'
         12        CONCAT                                           ~13     ~12, !1
         13        CONCAT                                           ~14     ~13, '%26Subtotal%3D'
         14        CONCAT                                           ~15     ~14, !2
         15        CONCAT                                           ~16     ~15, '%26FirstName%3DIvan%26LastName%3DIvanov%26Email%3Divan%40ivanov.ru%26Phone%3D1234567890'
         16        ECHO                                                     ~16
         17      > RETURN                                                   1

Class Signature:
Function setsalt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BFsUI
function name:  setSalt
number of ops:  4
compiled vars:  !0 = $salt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'salt'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function setsalt

Function generate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 40
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
Branch analysis from position: 8
filename:       /in/BFsUI
function name:  generate
number of ops:  47
compiled vars:  !0 = $orderNumber, !1 = $orderAmount, !2 = $orderId, !3 = $amountSum, !4 = $salt, !5 = $signature
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ISSET_ISEMPTY_CV                                 ~6      !0
          3        BOOL_NOT                                         ~7      ~6
          4      > JMPZ_EX                                          ~7      ~7, ->8
          5    >   ISSET_ISEMPTY_CV                                 ~8      !1
          6        BOOL_NOT                                         ~9      ~8
          7        BOOL                                             ~7      ~9
          8    > > JMPZ_EX                                          ~7      ~7, ->11
          9    >   ISSET_ISEMPTY_PROP_OBJ                           ~10     'salt'
         10        BOOL                                             ~7      ~10
         11    > > JMPZ                                                     ~7, ->40
   11    12    >   INIT_FCALL                                               'htmlentities'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !2, $11
   12    16        INIT_FCALL                                               'htmlentities'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $13     
         19        ASSIGN                                                   !1, $13
   13    20        INIT_FCALL                                               'str_replace'
         21        SEND_VAL                                                 <array>
         22        SEND_VAL                                                 <array>
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                         $15     
         25        CAST                                          5  ~16     $15
         26        MUL                                              ~17     ~16, 100
         27        ASSIGN                                                   !3, ~17
   14    28        FETCH_OBJ_R                                      ~19     'salt'
         29        ASSIGN                                                   !4, ~19
   15    30        INIT_FCALL                                               'md5'
         31        CONCAT                                           ~21     !2, '%26'
         32        CONCAT                                           ~22     ~21, !1
         33        CONCAT                                           ~23     ~22, '%26'
         34        CONCAT                                           ~24     ~23, !4
         35        SEND_VAL                                                 ~24
         36        DO_ICALL                                         $25     
         37        ASSIGN                                                   !5, $25
   17    38      > RETURN                                                   !5
         39*       JMP                                                      ->46
   20    40    >   NEW                                              $27     'Exception'
         41        SEND_VAL_EX                                              '%D0%9E%D1%88%D0%B8%D0%B1%D0%BA%D0%B0%3A+%D0%9D%D0%B5+%D0%B2%D0%B5%D1%80%D0%BD%D0%BE+%D0%BF%D0%B5%D1%80%D0%B5%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B+%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B+%D0%B4%D0%BB%D1%8F+%D0%B3%D0%B5%D0%BD%D0%B5%D1%80%D0%B0%D1%86%D0%B8%D0%B8+%D1%81%D0%B8%D0%B3%D0%BD%D0%B0%D1%82%D1%83%D1%80%D1%8B'
         42        SEND_VAL_EX                                              1
         43        DO_FCALL                                      0          
         44      > THROW                                         0          $27
   21    45*       RETURN                                                   0
   23    46*     > RETURN                                                   null

End of function generate

End of class Signature.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.33 ms | 1400 KiB | 19 Q