3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getyearly($monthly, $yearly) { if(!empty($monthly) && !empty($yearly)) { $permonth=intdiv((int)$yearly, 12); echo "Single payment will feel like 12-monthly payments of: $permonth (" , $permonth *12 . ")\n"; $monthlytoyear=(int)$monthly*12; echo "Making monthly payments will actually come to: $monthlytoyear\n"; $aftersub = $monthlytoyear-$yearly; echo "That is a difference of: $aftersub\n"; $afterdiv = $aftersub / $yearly; echo "In other words, a savings of: " , $afterdiv , "\n"; $finaly=(int)($afterdiv*100); return "$ ".$yearly."/year ($".round($permonth)."/month; save ~{$finaly}%)"; } else { return '$ '.$yearly.'/yearly'; } } $monthly='60'; $yearly= '480'; echo getyearly($monthly,$yearly);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U1nVo
function name:  (null)
number of ops:  8
compiled vars:  !0 = $monthly, !1 = $yearly
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, '60'
   20     1        ASSIGN                                                   !1, '480'
   22     2        INIT_FCALL                                               'getyearly'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7      > RETURN                                                   1

Function getyearly:
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 = 43) Position 1 = 9, Position 2 = 55
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/U1nVo
function name:  getyearly
number of ops:  59
compiled vars:  !0 = $monthly, !1 = $yearly, !2 = $permonth, !3 = $monthlytoyear, !4 = $aftersub, !5 = $afterdiv, !6 = $finaly
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        ISSET_ISEMPTY_CV                                 ~7      !0
          3        BOOL_NOT                                         ~8      ~7
          4      > JMPZ_EX                                          ~8      ~8, ->8
          5    >   ISSET_ISEMPTY_CV                                 ~9      !1
          6        BOOL_NOT                                         ~10     ~9
          7        BOOL                                             ~8      ~10
          8    > > JMPZ                                                     ~8, ->55
    4     9    >   INIT_FCALL                                               'intdiv'
         10        CAST                                          4  ~11     !1
         11        SEND_VAL                                                 ~11
         12        SEND_VAL                                                 12
         13        DO_ICALL                                         $12     
         14        ASSIGN                                                   !2, $12
    5    15        ROPE_INIT                                     3  ~15     'Single+payment+will+feel+like+12-monthly+payments+of%3A+'
         16        ROPE_ADD                                      1  ~15     ~15, !2
         17        ROPE_END                                      2  ~14     ~15, '+%28'
         18        ECHO                                                     ~14
         19        MUL                                              ~17     !2, 12
         20        CONCAT                                           ~18     ~17, '%29%0A'
         21        ECHO                                                     ~18
    6    22        CAST                                          4  ~19     !0
         23        MUL                                              ~20     ~19, 12
         24        ASSIGN                                                   !3, ~20
    7    25        ROPE_INIT                                     3  ~23     'Making+monthly+payments+will+actually+come+to%3A+'
         26        ROPE_ADD                                      1  ~23     ~23, !3
         27        ROPE_END                                      2  ~22     ~23, '%0A'
         28        ECHO                                                     ~22
    8    29        SUB                                              ~25     !3, !1
         30        ASSIGN                                                   !4, ~25
    9    31        ROPE_INIT                                     3  ~28     'That+is+a+difference+of%3A+'
         32        ROPE_ADD                                      1  ~28     ~28, !4
         33        ROPE_END                                      2  ~27     ~28, '%0A'
         34        ECHO                                                     ~27
   10    35        DIV                                              ~30     !4, !1
         36        ASSIGN                                                   !5, ~30
   11    37        ECHO                                                     'In+other+words%2C+a+savings+of%3A+'
         38        ECHO                                                     !5
         39        ECHO                                                     '%0A'
   12    40        MUL                                              ~32     !5, 100
         41        CAST                                          4  ~33     ~32
         42        ASSIGN                                                   !6, ~33
   13    43        CONCAT                                           ~35     '%24+', !1
         44        CONCAT                                           ~36     ~35, '%2Fyear+%28%24'
         45        INIT_FCALL                                               'round'
         46        SEND_VAR                                                 !2
         47        DO_ICALL                                         $37     
         48        CONCAT                                           ~38     ~36, $37
         49        ROPE_INIT                                     3  ~40     '%2Fmonth%3B+save+%7E'
         50        ROPE_ADD                                      1  ~40     ~40, !6
         51        ROPE_END                                      2  ~39     ~40, '%25%29'
         52        CONCAT                                           ~42     ~38, ~39
         53      > RETURN                                                   ~42
    3    54*       JMP                                                      ->58
   15    55    >   CONCAT                                           ~43     '%24+', !1
         56        CONCAT                                           ~44     ~43, '%2Fyearly'
         57      > RETURN                                                   ~44
   18    58*     > RETURN                                                   null

End of function getyearly

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.56 ms | 1019 KiB | 16 Q