3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); $amount = 200; $amountInAtm = 0; $bills = array( 5000 => 200, 1000 => 0, 500 => 0, 100 => 0, ); foreach ($bills as $key => $value) { $amountInAtm += $key * $value; } if ($amount > $amountInAtm){ echo "Выдача невозможна: в банкомате недостаточно купюр"; exit(); } elseif ($amount <= 0){ echo "Выдача невозможна: требуемая сумма больше или равна 0"; exit(); } elseif ($amount % 100 != 0){ echo "Выдача невозможна: требуемая сумма не кратка 100"; exit(); } echo "Сумма: $amount\n"; $billsForDelivery = array( 5000 => 0, 1000 => 0, 500 => 0, 100 => 0, ); foreach ($bills as $key => $value) { while ($key <= $amount){ $billsForDelivery[$key]++; $amount -= $key; } } echo "Выдача возможна, число купюр:\n"; foreach ($billsForDelivery as $key => $value) { echo "{$value}x{$key} "; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 43
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 43
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 37
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 37
Branch analysis from position: 42
Branch analysis from position: 37
Branch analysis from position: 43
2 jumps found. (Code = 77) Position 1 = 46, Position 2 = 54
Branch analysis from position: 46
2 jumps found. (Code = 78) Position 1 = 47, Position 2 = 54
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
Branch analysis from position: 43
Branch analysis from position: 12
filename:       /in/JX2Hd
function name:  (null)
number of ops:  56
compiled vars:  !0 = $amount, !1 = $amountInAtm, !2 = $bills, !3 = $value, !4 = $key, !5 = $billsForDelivery
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 -1
          2        DO_ICALL                                                 
    5     3        ASSIGN                                                   !0, 200
    6     4        ASSIGN                                                   !1, 0
    7     5        ASSIGN                                                   !2, <array>
   14     6      > FE_RESET_R                                       $10     !2, ->12
          7    > > FE_FETCH_R                                       ~11     $10, !3, ->12
          8    >   ASSIGN                                                   !4, ~11
   15     9        MUL                                              ~13     !4, !3
         10        ASSIGN_OP                                     1          !1, ~13
   14    11      > JMP                                                      ->7
         12    >   FE_FREE                                                  $10
   18    13        IS_SMALLER                                               !1, !0
         14      > JMPZ                                                     ~15, ->18
   19    15    >   ECHO                                                     '%D0%92%D1%8B%D0%B4%D0%B0%D1%87%D0%B0+%D0%BD%D0%B5%D0%B2%D0%BE%D0%B7%D0%BC%D0%BE%D0%B6%D0%BD%D0%B0%3A+%D0%B2+%D0%B1%D0%B0%D0%BD%D0%BA%D0%BE%D0%BC%D0%B0%D1%82%D0%B5+%D0%BD%D0%B5%D0%B4%D0%BE%D1%81%D1%82%D0%B0%D1%82%D0%BE%D1%87%D0%BD%D0%BE+%D0%BA%D1%83%D0%BF%D1%8E%D1%80'
   20    16      > EXIT                                                     
         17*       JMP                                                      ->28
   21    18    >   IS_SMALLER_OR_EQUAL                                      !0, 0
         19      > JMPZ                                                     ~16, ->23
   22    20    >   ECHO                                                     '%D0%92%D1%8B%D0%B4%D0%B0%D1%87%D0%B0+%D0%BD%D0%B5%D0%B2%D0%BE%D0%B7%D0%BC%D0%BE%D0%B6%D0%BD%D0%B0%3A+%D1%82%D1%80%D0%B5%D0%B1%D1%83%D0%B5%D0%BC%D0%B0%D1%8F+%D1%81%D1%83%D0%BC%D0%BC%D0%B0+%D0%B1%D0%BE%D0%BB%D1%8C%D1%88%D0%B5+%D0%B8%D0%BB%D0%B8+%D1%80%D0%B0%D0%B2%D0%BD%D0%B0+0'
   23    21      > EXIT                                                     
         22*       JMP                                                      ->28
   24    23    >   MOD                                              ~17     !0, 100
         24        IS_NOT_EQUAL                                             ~17, 0
         25      > JMPZ                                                     ~18, ->28
   25    26    >   ECHO                                                     '%D0%92%D1%8B%D0%B4%D0%B0%D1%87%D0%B0+%D0%BD%D0%B5%D0%B2%D0%BE%D0%B7%D0%BC%D0%BE%D0%B6%D0%BD%D0%B0%3A+%D1%82%D1%80%D0%B5%D0%B1%D1%83%D0%B5%D0%BC%D0%B0%D1%8F+%D1%81%D1%83%D0%BC%D0%BC%D0%B0+%D0%BD%D0%B5+%D0%BA%D1%80%D0%B0%D1%82%D0%BA%D0%B0+100'
   26    27      > EXIT                                                     
   29    28    >   ROPE_INIT                                     3  ~20     '%D0%A1%D1%83%D0%BC%D0%BC%D0%B0%3A+'
         29        ROPE_ADD                                      1  ~20     ~20, !0
         30        ROPE_END                                      2  ~19     ~20, '%0A'
         31        ECHO                                                     ~19
   31    32        ASSIGN                                                   !5, <array>
   38    33      > FE_RESET_R                                       $23     !2, ->43
         34    > > FE_FETCH_R                                       ~24     $23, !3, ->43
         35    >   ASSIGN                                                   !4, ~24
   39    36      > JMP                                                      ->40
   40    37    >   FETCH_DIM_RW                                     $26     !5, !4
         38        PRE_INC                                                  $26
   41    39        ASSIGN_OP                                     2          !0, !4
   39    40    >   IS_SMALLER_OR_EQUAL                                      !4, !0
         41      > JMPNZ                                                    ~29, ->37
   38    42    > > JMP                                                      ->34
         43    >   FE_FREE                                                  $23
   45    44        ECHO                                                     '%D0%92%D1%8B%D0%B4%D0%B0%D1%87%D0%B0+%D0%B2%D0%BE%D0%B7%D0%BC%D0%BE%D0%B6%D0%BD%D0%B0%2C+%D1%87%D0%B8%D1%81%D0%BB%D0%BE+%D0%BA%D1%83%D0%BF%D1%8E%D1%80%3A%0A'
   46    45      > FE_RESET_R                                       $30     !5, ->54
         46    > > FE_FETCH_R                                       ~31     $30, !3, ->54
         47    >   ASSIGN                                                   !4, ~31
   47    48        ROPE_INIT                                     4  ~34     !3
         49        ROPE_ADD                                      1  ~34     ~34, 'x'
         50        ROPE_ADD                                      2  ~34     ~34, !4
         51        ROPE_END                                      3  ~33     ~34, '+'
         52        ECHO                                                     ~33
   46    53      > JMP                                                      ->46
         54    >   FE_FREE                                                  $30
   48    55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.81 ms | 1405 KiB | 15 Q