3v4l.org

run code in 200+ 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);
based on uJd9E

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for branch php-master
10 Warning: Undefined variable: i in /in/dQ7Qi on line 8 Warning: Undefined variable: best in /in/dQ7Qi on line 8 Warning: Undefined variable: bestCount in /in/dQ7Qi on line 8 NULL NULL NULL
Output for branch php-master+jit
10 Warning: Undefined variable: i in /in/dQ7Qi on line 8 Warning: Undefined variable: best in /in/dQ7Qi on line 8 Warning: Undefined variable: bestCount in /in/dQ7Qi on line 8 NULL NULL NULL
Output for branch php-master+opcache
10 Warning: Undefined variable: i in /in/dQ7Qi on line 8 Warning: Undefined variable: best in /in/dQ7Qi on line 8 Warning: Undefined variable: bestCount in /in/dQ7Qi on line 8 NULL NULL NULL

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page