3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sumPrice = 5.00; $subTotal = 0.00; $voucherSum = sprintf('%01.2f', (sprintf('%01.2f',$sumPrice) - sprintf('%01.2f',$subtotal))); $parameter['has_voucher'] = (abs($voucherSum) >= 0.01) ? 1 : 0; $parameter['discount'] = $this->_convertToCurrency($listPrice - $sumPrice); $parameter['discount_percentage'] = sprintf('%01.0f', round(100 - (($sumPrice / $listPrice) * 100))); var_dump($voucherSum); var_dump($parameter);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XndKp
function name:  (null)
number of ops:  52
compiled vars:  !0 = $sumPrice, !1 = $subTotal, !2 = $voucherSum, !3 = $subtotal, !4 = $parameter, !5 = $listPrice
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 5
    4     1        ASSIGN                                                   !1, 0
    6     2        INIT_FCALL                                               'sprintf'
          3        SEND_VAL                                                 '%2501.2f'
          4        INIT_FCALL                                               'sprintf'
          5        SEND_VAL                                                 '%2501.2f'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $8      
          8        INIT_FCALL                                               'sprintf'
          9        SEND_VAL                                                 '%2501.2f'
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $9      
         12        SUB                                              ~10     $8, $9
         13        SEND_VAL                                                 ~10
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !2, $11
    7    16        INIT_FCALL                                               'abs'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $14     
         19        IS_SMALLER_OR_EQUAL                                      0.01, $14
         20      > JMPZ                                                     ~15, ->23
         21    >   QM_ASSIGN                                        ~16     1
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~16     0
         24    >   ASSIGN_DIM                                               !4, 'has_voucher'
         25        OP_DATA                                                  ~16
    8    26        FETCH_THIS                                       $18     
         27        INIT_METHOD_CALL                                         $18, '_convertToCurrency'
         28        SUB                                              ~19     !5, !0
         29        SEND_VAL_EX                                              ~19
         30        DO_FCALL                                      0  $20     
         31        ASSIGN_DIM                                               !4, 'discount'
         32        OP_DATA                                                  $20
    9    33        INIT_FCALL                                               'sprintf'
         34        SEND_VAL                                                 '%2501.0f'
         35        INIT_FCALL                                               'round'
         36        DIV                                              ~22     !0, !5
         37        MUL                                              ~23     ~22, 100
         38        SUB                                              ~24     100, ~23
         39        SEND_VAL                                                 ~24
         40        DO_ICALL                                         $25     
         41        SEND_VAR                                                 $25
         42        DO_ICALL                                         $26     
         43        ASSIGN_DIM                                               !4, 'discount_percentage'
         44        OP_DATA                                                  $26
   11    45        INIT_FCALL                                               'var_dump'
         46        SEND_VAR                                                 !2
         47        DO_ICALL                                                 
   12    48        INIT_FCALL                                               'var_dump'
         49        SEND_VAR                                                 !4
         50        DO_ICALL                                                 
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.17 ms | 1400 KiB | 21 Q