3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lizards = []; for ($i = 0; $i < 15; $i++) { $lizards[] = 1; } for ($i = 0; $i < 7; $i++) { $lizards[] = 2; } for ($i = 0; $i < 8; $i++) { $lizards[] = 3; } srand(time()); for ($i = 0; $i < 10000; $i++) { $a1 = mt_rand(0, count($lizards) - 1); do { $a2 = mt_rand(0, count($lizards) - 1); } while ($a1 == $a2); if ($lizards[$a1] == $lizards[$a2]) { continue; } $new_color = 6 - $lizards[$a1] - $lizards[$a2]; $lizards[$a1] = $new_color; $lizards[$a2] = $new_color; $colors_count = (in_array(1, $lizards) ? 1 : 0) + (in_array(2, $lizards) ? 1 : 0) + (in_array(3, $lizards) ? 1 : 0); if ($colors_count == 1) { echo "Остался только один цвет\n"; break; } $counts = [null, 0, 0, 0]; foreach ($lizards as $color) { $counts[$color]++; } echo sprintf("%s\t%s\t%s\n", $counts[1], $counts[2], $counts[3]); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 10
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 17
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
2 jumps found. (Code = 44) Position 1 = 110, Position 2 = 29
Branch analysis from position: 110
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 36
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 50
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 107
Branch analysis from position: 107
2 jumps found. (Code = 44) Position 1 = 110, Position 2 = 29
Branch analysis from position: 110
Branch analysis from position: 29
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 66
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 74
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 83
Branch analysis from position: 81
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 88, Position 2 = 90
Branch analysis from position: 88
1 jumps found. (Code = 42) Position 1 = 110
Branch analysis from position: 110
Branch analysis from position: 90
2 jumps found. (Code = 77) Position 1 = 92, Position 2 = 96
Branch analysis from position: 92
2 jumps found. (Code = 78) Position 1 = 93, Position 2 = 96
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
Branch analysis from position: 96
2 jumps found. (Code = 44) Position 1 = 110, Position 2 = 29
Branch analysis from position: 110
Branch analysis from position: 29
Branch analysis from position: 96
Branch analysis from position: 83
2 jumps found. (Code = 43) Position 1 = 88, Position 2 = 90
Branch analysis from position: 88
Branch analysis from position: 90
Branch analysis from position: 74
2 jumps found. (Code = 43) Position 1 = 81, Position 2 = 83
Branch analysis from position: 81
Branch analysis from position: 83
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 72, Position 2 = 74
Branch analysis from position: 72
Branch analysis from position: 74
Branch analysis from position: 36
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 17
Branch analysis from position: 22
Branch analysis from position: 17
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 10
Branch analysis from position: 15
Branch analysis from position: 10
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 3
Branch analysis from position: 8
Branch analysis from position: 3
filename:       /in/l9Q0N
function name:  (null)
number of ops:  111
compiled vars:  !0 = $lizards, !1 = $i, !2 = $a1, !3 = $a2, !4 = $new_color, !5 = $colors_count, !6 = $counts, !7 = $color
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->6
    4     3    >   ASSIGN_DIM                                               !0
          4        OP_DATA                                                  1
    3     5        PRE_INC                                                  !1
          6    >   IS_SMALLER                                               !1, 15
          7      > JMPNZ                                                    ~12, ->3
    6     8    >   ASSIGN                                                   !1, 0
          9      > JMP                                                      ->13
    7    10    >   ASSIGN_DIM                                               !0
         11        OP_DATA                                                  2
    6    12        PRE_INC                                                  !1
         13    >   IS_SMALLER                                               !1, 7
         14      > JMPNZ                                                    ~16, ->10
    9    15    >   ASSIGN                                                   !1, 0
         16      > JMP                                                      ->20
   10    17    >   ASSIGN_DIM                                               !0
         18        OP_DATA                                                  3
    9    19        PRE_INC                                                  !1
         20    >   IS_SMALLER                                               !1, 8
         21      > JMPNZ                                                    ~20, ->17
   13    22    >   INIT_FCALL                                               'srand'
         23        INIT_FCALL                                               'time'
         24        DO_ICALL                                         $21     
         25        SEND_VAR                                                 $21
         26        DO_ICALL                                                 
   14    27        ASSIGN                                                   !1, 0
         28      > JMP                                                      ->108
   15    29    >   INIT_FCALL                                               'mt_rand'
         30        SEND_VAL                                                 0
         31        COUNT                                            ~24     !0
         32        SUB                                              ~25     ~24, 1
         33        SEND_VAL                                                 ~25
         34        DO_ICALL                                         $26     
         35        ASSIGN                                                   !2, $26
   17    36    >   INIT_FCALL                                               'mt_rand'
         37        SEND_VAL                                                 0
         38        COUNT                                            ~28     !0
         39        SUB                                              ~29     ~28, 1
         40        SEND_VAL                                                 ~29
         41        DO_ICALL                                         $30     
         42        ASSIGN                                                   !3, $30
   18    43        IS_EQUAL                                                 !2, !3
         44      > JMPNZ                                                    ~32, ->36
   19    45    >   FETCH_DIM_R                                      ~33     !0, !2
         46        FETCH_DIM_R                                      ~34     !0, !3
         47        IS_EQUAL                                                 ~33, ~34
         48      > JMPZ                                                     ~35, ->50
   20    49    > > JMP                                                      ->107
   23    50    >   FETCH_DIM_R                                      ~36     !0, !2
         51        SUB                                              ~37     6, ~36
         52        FETCH_DIM_R                                      ~38     !0, !3
         53        SUB                                              ~39     ~37, ~38
         54        ASSIGN                                                   !4, ~39
   24    55        ASSIGN_DIM                                               !0, !2
         56        OP_DATA                                                  !4
   25    57        ASSIGN_DIM                                               !0, !3
         58        OP_DATA                                                  !4
   27    59        INIT_FCALL                                               'in_array'
         60        SEND_VAL                                                 1
         61        SEND_VAR                                                 !0
         62        DO_ICALL                                         $43     
         63      > JMPZ                                                     $43, ->66
         64    >   QM_ASSIGN                                        ~44     1
         65      > JMP                                                      ->67
         66    >   QM_ASSIGN                                        ~44     0
         67    >   INIT_FCALL                                               'in_array'
         68        SEND_VAL                                                 2
         69        SEND_VAR                                                 !0
         70        DO_ICALL                                         $45     
         71      > JMPZ                                                     $45, ->74
         72    >   QM_ASSIGN                                        ~46     1
         73      > JMP                                                      ->75
         74    >   QM_ASSIGN                                        ~46     0
         75    >   ADD                                              ~47     ~44, ~46
         76        INIT_FCALL                                               'in_array'
         77        SEND_VAL                                                 3
         78        SEND_VAR                                                 !0
         79        DO_ICALL                                         $48     
         80      > JMPZ                                                     $48, ->83
         81    >   QM_ASSIGN                                        ~49     1
         82      > JMP                                                      ->84
         83    >   QM_ASSIGN                                        ~49     0
         84    >   ADD                                              ~50     ~47, ~49
         85        ASSIGN                                                   !5, ~50
   28    86        IS_EQUAL                                                 !5, 1
         87      > JMPZ                                                     ~52, ->90
   29    88    >   ECHO                                                     '%D0%9E%D1%81%D1%82%D0%B0%D0%BB%D1%81%D1%8F+%D1%82%D0%BE%D0%BB%D1%8C%D0%BA%D0%BE+%D0%BE%D0%B4%D0%B8%D0%BD+%D1%86%D0%B2%D0%B5%D1%82%0A'
   30    89      > JMP                                                      ->110
   32    90    >   ASSIGN                                                   !6, <array>
   33    91      > FE_RESET_R                                       $54     !0, ->96
         92    > > FE_FETCH_R                                               $54, !7, ->96
   34    93    >   FETCH_DIM_RW                                     $55     !6, !7
         94        PRE_INC                                                  $55
   33    95      > JMP                                                      ->92
         96    >   FE_FREE                                                  $54
   36    97        INIT_FCALL                                               'sprintf'
         98        SEND_VAL                                                 '%25s%09%25s%09%25s%0A'
         99        FETCH_DIM_R                                      ~57     !6, 1
        100        SEND_VAL                                                 ~57
        101        FETCH_DIM_R                                      ~58     !6, 2
        102        SEND_VAL                                                 ~58
        103        FETCH_DIM_R                                      ~59     !6, 3
        104        SEND_VAL                                                 ~59
        105        DO_ICALL                                         $60     
        106        ECHO                                                     $60
   14   107    >   PRE_INC                                                  !1
        108    >   IS_SMALLER                                               !1, 10000
        109      > JMPNZ                                                    ~62, ->29
   39   110    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.36 ms | 1017 KiB | 18 Q