3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = "01001010101101111011101001010100010101101010101010101101101010010110110110"; $n = 10; for($a=$b=$c=0;(($d=@substr_count($s,1,$a,$n))>$c&&(($b=$a)&&($c=$d)))||$a<strlen($s);$a++);echo $b; var_dump($i,$best,$bestCount);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 6
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
Branch analysis from position: 23
Branch analysis from position: 27
Branch analysis from position: 22
Branch analysis from position: 23
filename:       /in/dQ7Qi
function name:  (null)
number of ops:  35
compiled vars:  !0 = $s, !1 = $n, !2 = $a, !3 = $b, !4 = $c, !5 = $d, !6 = $i, !7 = $best, !8 = $bestCount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '01001010101101111011101001010100010101101010101010101101101010010110110110'
    4     1        ASSIGN                                                   !1, 10
    6     2        ASSIGN                                           ~11     !4, 0
          3        ASSIGN                                           ~12     !3, ~11
          4        ASSIGN                                                   !2, ~12
          5      > JMP                                                      ->7
          6    >   PRE_INC                                                  !2
          7    >   BEGIN_SILENCE                                    ~15     
          8        INIT_FCALL                                               'substr_count'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 1
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $16     
         14        END_SILENCE                                              ~15
         15        ASSIGN                                           ~17     !5, $16
         16        IS_SMALLER                                       ~18     !4, ~17
         17      > JMPZ_EX                                          ~18     ~18, ->23
         18    >   ASSIGN                                           ~19     !3, !2
         19      > JMPZ_EX                                          ~19     ~19, ->22
         20    >   ASSIGN                                           ~20     !4, !5
         21        BOOL                                             ~19     ~20
         22    >   BOOL                                             ~18     ~19
         23    > > JMPNZ_EX                                         ~18     ~18, ->27
         24    >   STRLEN                                           ~21     !0
         25        IS_SMALLER                                       ~22     !2, ~21
         26        BOOL                                             ~18     ~22
         27    > > JMPNZ                                                    ~18, ->6
         28    >   ECHO                                                     !3
    8    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !6
         31        SEND_VAR                                                 !7
         32        SEND_VAR                                                 !8
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
205.2 ms | 1400 KiB | 17 Q