3v4l.org

run code in 300+ PHP versions simultaneously
<?php $amount = 10000000; $amount = number_format($amount,0,'',''); if($amount < 1) { return 0; } $number_sep = array(); $multi = 1; $exit = false; $i = 1000; for($j=3;$j < 15 ;$j=$j+2) { switch($j) { case 3: $temp = ($amount/$i);$temp = round(($temp - floor($temp)) * 1000,2); if($i < $amount) { if(!$temp) { $number_sep[] = '000'; } else { $amount = $amount - $temp; $number_sep[] = str_pad(round($temp,2),3,'0',STR_PAD_LEFT); } } else { if(!$temp) { $number_sep[] = $i; } else { $number_sep[] = round($temp,2); } $exit = true; } break; case $j > 3 : $temp = $amount % $i; if($i < $amount) { if(!$temp) { $number_sep[] = '00'; } else { $amount = $amount - $temp; $number_sep[] = str_pad(round($temp/($i/100)),2,'0',STR_PAD_LEFT); } } else { if(!$temp) { $number_sep[] = '00'; } else { $number_sep[] = round($temp/($i/100)); } $exit = true; }; break; } if($exit) { break; } $i = 10 * 10 * $i; } echo $i;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 115
Branch analysis from position: 115
2 jumps found. (Code = 44) Position 1 = 117, Position 2 = 17
Branch analysis from position: 117
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 70
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
2 jumps found. (Code = 43) Position 1 = 110, Position 2 = 111
Branch analysis from position: 110
1 jumps found. (Code = 42) Position 1 = 117
Branch analysis from position: 117
Branch analysis from position: 111
2 jumps found. (Code = 44) Position 1 = 117, Position 2 = 17
Branch analysis from position: 117
Branch analysis from position: 17
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 95
Branch analysis from position: 74
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 79
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 94
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
Branch analysis from position: 79
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 95
2 jumps found. (Code = 43) Position 1 = 97, Position 2 = 100
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 107
Branch analysis from position: 107
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
Branch analysis from position: 100
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 57
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 42
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 69
Branch analysis from position: 69
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 62
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
filename:       /in/EOvYQ
function name:  (null)
number of ops:  119
compiled vars:  !0 = $amount, !1 = $number_sep, !2 = $multi, !3 = $exit, !4 = $i, !5 = $j, !6 = $temp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 10000000
    3     1        INIT_FCALL                                               'number_format'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 0
          4        SEND_VAL                                                 ''
          5        SEND_VAL                                                 ''
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !0, $8
    4     8        IS_SMALLER                                               !0, 1
          9      > JMPZ                                                     ~10, ->11
    5    10    > > RETURN                                                   0
    7    11    >   ASSIGN                                                   !1, <array>
    8    12        ASSIGN                                                   !2, 1
    9    13        ASSIGN                                                   !3, <false>
   10    14        ASSIGN                                                   !4, 1000
   11    15        ASSIGN                                                   !5, 3
         16      > JMP                                                      ->115
   14    17    >   IS_EQUAL                                                 !5, 3
         18      > JMPNZ                                                    ~16, ->23
   31    19    >   IS_SMALLER                                       ~17     3, !5
         20        IS_EQUAL                                                 !5, ~17
         21      > JMPNZ                                                    ~16, ->70
         22    > > JMP                                                      ->109
   14    23    >   DIV                                              ~18     !0, !4
         24        ASSIGN                                                   !6, ~18
         25        INIT_FCALL                                               'round'
         26        INIT_FCALL                                               'floor'
         27        SEND_VAR                                                 !6
         28        DO_ICALL                                         $20     
         29        SUB                                              ~21     !6, $20
         30        MUL                                              ~22     ~21, 1000
         31        SEND_VAL                                                 ~22
         32        SEND_VAL                                                 2
         33        DO_ICALL                                         $23     
         34        ASSIGN                                                   !6, $23
   15    35        IS_SMALLER                                               !4, !0
         36      > JMPZ                                                     ~25, ->57
   16    37    >   BOOL_NOT                                         ~26     !6
         38      > JMPZ                                                     ~26, ->42
   17    39    >   ASSIGN_DIM                                               !1
         40        OP_DATA                                                  '000'
         41      > JMP                                                      ->56
   19    42    >   SUB                                              ~28     !0, !6
         43        ASSIGN                                                   !0, ~28
   20    44        INIT_FCALL                                               'str_pad'
         45        INIT_FCALL                                               'round'
         46        SEND_VAR                                                 !6
         47        SEND_VAL                                                 2
         48        DO_ICALL                                         $31     
         49        SEND_VAR                                                 $31
         50        SEND_VAL                                                 3
         51        SEND_VAL                                                 '0'
         52        SEND_VAL                                                 0
         53        DO_ICALL                                         $32     
         54        ASSIGN_DIM                                               !1
         55        OP_DATA                                                  $32
         56    > > JMP                                                      ->69
   23    57    >   BOOL_NOT                                         ~33     !6
         58      > JMPZ                                                     ~33, ->62
   24    59    >   ASSIGN_DIM                                               !1
         60        OP_DATA                                                  !4
         61      > JMP                                                      ->68
   26    62    >   INIT_FCALL                                               'round'
         63        SEND_VAR                                                 !6
         64        SEND_VAL                                                 2
         65        DO_ICALL                                         $36     
         66        ASSIGN_DIM                                               !1
         67        OP_DATA                                                  $36
   28    68    >   ASSIGN                                                   !3, <true>
   30    69    > > JMP                                                      ->109
   31    70    >   MOD                                              ~38     !0, !4
         71        ASSIGN                                                   !6, ~38
   33    72        IS_SMALLER                                               !4, !0
         73      > JMPZ                                                     ~40, ->95
   34    74    >   BOOL_NOT                                         ~41     !6
         75      > JMPZ                                                     ~41, ->79
   35    76    >   ASSIGN_DIM                                               !1
         77        OP_DATA                                                  '00'
         78      > JMP                                                      ->94
   37    79    >   SUB                                              ~43     !0, !6
         80        ASSIGN                                                   !0, ~43
   38    81        INIT_FCALL                                               'str_pad'
         82        INIT_FCALL                                               'round'
         83        DIV                                              ~46     !4, 100
         84        DIV                                              ~47     !6, ~46
         85        SEND_VAL                                                 ~47
         86        DO_ICALL                                         $48     
         87        SEND_VAR                                                 $48
         88        SEND_VAL                                                 2
         89        SEND_VAL                                                 '0'
         90        SEND_VAL                                                 0
         91        DO_ICALL                                         $49     
         92        ASSIGN_DIM                                               !1
         93        OP_DATA                                                  $49
         94    > > JMP                                                      ->108
   41    95    >   BOOL_NOT                                         ~50     !6
         96      > JMPZ                                                     ~50, ->100
   42    97    >   ASSIGN_DIM                                               !1
         98        OP_DATA                                                  '00'
         99      > JMP                                                      ->107
   44   100    >   INIT_FCALL                                               'round'
        101        DIV                                              ~53     !4, 100
        102        DIV                                              ~54     !6, ~53
        103        SEND_VAL                                                 ~54
        104        DO_ICALL                                         $55     
        105        ASSIGN_DIM                                               !1
        106        OP_DATA                                                  $55
   46   107    >   ASSIGN                                                   !3, <true>
   48   108    > > JMP                                                      ->109
   51   109    > > JMPZ                                                     !3, ->111
   52   110    > > JMP                                                      ->117
   54   111    >   MUL                                              ~57     !4, 100
        112        ASSIGN                                                   !4, ~57
   11   113        ADD                                              ~59     !5, 2
        114        ASSIGN                                                   !5, ~59
        115    >   IS_SMALLER                                               !5, 15
        116      > JMPNZ                                                    ~61, ->17
   56   117    >   ECHO                                                     !4
        118      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.85 ms | 1408 KiB | 21 Q