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; } } } $sign = new Signature; $firstName = 'Ivan'; $lastName = 'Ivanov'; $email = 'ivan@ivanov.ivn'; $phone = '12345678901'; $orderNumber = 77777; $orderAmount = 675.30; $signature = $sign->generate($orderNumber, $orderAmount); echo 'http://mirusoft.ru/include/payments/aq.php' .'?Signature='.$signature .'&Order_ID='.$orderNumber .'&Subtotal='.$orderAmount .'&FirstName='.$firstName .'&LastName='.$lastName .'&Email='.$email .'&Phone='.$phone;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fU5gs
function name:  (null)
number of ops:  29
compiled vars:  !0 = $sign, !1 = $firstName, !2 = $lastName, !3 = $email, !4 = $phone, !5 = $orderNumber, !6 = $orderAmount, !7 = $signature
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $8      'Signature'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $8
   28     3        ASSIGN                                                   !1, 'Ivan'
   29     4        ASSIGN                                                   !2, 'Ivanov'
   30     5        ASSIGN                                                   !3, 'ivan%40ivanov.ivn'
   31     6        ASSIGN                                                   !4, '12345678901'
   34     7        ASSIGN                                                   !5, 77777
   35     8        ASSIGN                                                   !6, 675.3
   36     9        INIT_METHOD_CALL                                         !0, 'generate'
         10        SEND_VAR_EX                                              !5
         11        SEND_VAR_EX                                              !6
         12        DO_FCALL                                      0  $17     
         13        ASSIGN                                                   !7, $17
   38    14        CONCAT                                           ~19     'http%3A%2F%2Fmirusoft.ru%2Finclude%2Fpayments%2Faq.php%3FSignature%3D', !7
   39    15        CONCAT                                           ~20     ~19, '%26Order_ID%3D'
         16        CONCAT                                           ~21     ~20, !5
   40    17        CONCAT                                           ~22     ~21, '%26Subtotal%3D'
         18        CONCAT                                           ~23     ~22, !6
   41    19        CONCAT                                           ~24     ~23, '%26FirstName%3D'
         20        CONCAT                                           ~25     ~24, !1
   42    21        CONCAT                                           ~26     ~25, '%26LastName%3D'
         22        CONCAT                                           ~27     ~26, !2
   43    23        CONCAT                                           ~28     ~27, '%26Email%3D'
         24        CONCAT                                           ~29     ~28, !3
   44    25        CONCAT                                           ~30     ~29, '%26Phone%3D'
         26        CONCAT                                           ~31     ~30, !4
         27        ECHO                                                     ~31
         28      > RETURN                                                   1

Class Signature:
Function setsalt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fU5gs
function name:  setSalt
number of ops:  4
compiled vars:  !0 = $salt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ                                               'salt'
          2        OP_DATA                                                  !0
    8     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/fU5gs
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
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     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
   12    12    >   INIT_FCALL                                               'htmlentities'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !2, $11
   13    16        INIT_FCALL                                               'htmlentities'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $13     
         19        ASSIGN                                                   !1, $13
   14    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
   15    28        FETCH_OBJ_R                                      ~19     'salt'
         29        ASSIGN                                                   !4, ~19
   16    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
   18    38      > RETURN                                                   !5
         39*       JMP                                                      ->46
   21    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
   22    45*       RETURN                                                   0
   24    46*     > RETURN                                                   null

End of function generate

End of class Signature.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.12 ms | 1396 KiB | 19 Q