3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $maxMatches = 3; $matches = array('tails' => 0, 'heads' => 0, 'total' => 0); while(max($matches['tails'], $matches['heads']) < $maxMatches) { $faceType = rand(0, 1); if ($faceType) { $matches['heads']++; $matches['tails'] = 0; echo $faceType . " is heads\n"; } else { $matches['tails']++; $matches['heads'] = 0; echo $faceType." is tails\n"; } $matches['total']++; } echo "total flips took is: " . $matches['total'];
Output for 5.6.17, 7.1.0
0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 8
Output for 7.0.14
0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 12
Output for 4.4.1, 5.4.29, 5.4.36, 5.5.26, 5.6.8, 7.0.6
1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 5
Output for 4.3.10, 4.4.4, 5.0.5, 5.1.2, 5.2.16, 5.3.2, 5.3.4, 5.3.11, 5.3.21, 5.4.5, 5.4.8, 5.4.24 - 5.4.27, 5.4.34, 5.4.38, 5.4.45 - 5.5.24, 5.5.28, 5.6.9, 5.6.13, 5.6.16, 7.0.2, 7.0.5
0 is tails 0 is tails 0 is tails total flips took is: 3
Output for 5.2.2, 5.2.5, 5.2.9, 5.3.5, 5.4.9, 5.5.34, 7.0.4
0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 5
Output for 4.4.0, 4.4.9, 5.1.4, 5.2.8, 5.4.13, 5.4.42, 7.0.3
1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 4
Output for 7.0.1
1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 34
Output for 5.3.26, 5.5.33, 7.0.0
0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 9
Output for 5.2.7, 5.6.28
0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 6
Output for 4.3.1 - 4.3.3, 4.3.5, 4.4.5, 5.0.0 - 5.0.1, 5.1.5, 5.2.1, 5.2.6, 5.2.11, 5.2.14, 5.3.23, 5.3.27, 5.3.29, 5.4.2, 5.4.4, 5.4.12, 5.4.30, 5.4.43, 5.6.20 - 5.6.21
1 is heads 1 is heads 1 is heads total flips took is: 3
Output for 5.6.19
0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 5
Output for 5.6.18
1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 7
Output for 5.6.15
1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 11
Output for 5.6.14
1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 12
Output for 5.6.12
1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 15
Output for 5.6.11
1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 8
Output for 5.6.10
0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 6
Output for 5.5.35
1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 14
Output for 5.4.28, 5.5.32
1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 6
Output for 5.3.18, 5.5.31
0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 7
Output for 5.5.30
0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 16
Output for 4.4.2, 5.5.29
1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 6
Output for 5.5.27
0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 8
Output for 5.5.25
1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 8
Output for 5.3.16, 5.4.44
0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 7
Output for 5.1.3, 5.4.11, 5.4.41
1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 5
Output for 5.4.40
0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 22
Output for 5.4.39
1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 13
Output for 5.4.37
0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 11
Output for 5.4.35
0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 7
Output for 5.4.32
0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 10
Output for 5.4.31
1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 12
Output for 5.4.23
0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 15
Output for 5.4.22
0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 14
Output for 5.4.21
1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 13
Output for 4.3.8, 5.4.20
1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 7
Output for 5.4.19
1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 24
Output for 5.4.18
1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 10
Output for 5.3.24, 5.4.17
0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 8
Output for 5.0.2, 5.2.3, 5.4.16
1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 6
Output for 5.4.15
0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 10
Output for 5.2.10, 5.4.14
0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 9
Output for 4.3.0, 5.0.3 - 5.0.4, 5.1.6, 5.3.20, 5.4.0, 5.4.6, 5.4.10
0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 4
Output for 5.4.7
0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 8
Output for 5.3.12, 5.4.3
1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 7
Output for 5.4.1
0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 11
Output for 4.4.7, 5.3.28
1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 8
Output for 5.3.25
1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 14
Output for 5.3.22
0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 10
Output for 5.3.19
1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 15
Output for 5.3.17
1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 10
Output for 5.3.15
1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 11
Output for 5.3.14
1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 25
Output for 5.3.13
1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 13
Output for 5.3.10
1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 9
Output for 5.3.9
1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 9
Output for 5.3.8
1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 16
Output for 5.3.7
0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 11
Output for 5.3.6
1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 9
Output for 5.3.3
0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 16
Output for 5.3.1
1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 10
Output for 5.2.4, 5.3.0
0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 6
Output for 5.2.17
0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 8
Output for 5.2.15
0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 8
Output for 5.2.13
1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 9
Output for 5.2.12
1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 19
Output for 5.2.0
0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 11
Output for 5.1.1
0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 9
Output for 5.1.0
0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 13
Output for 4.4.8
0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 10
Output for 4.4.6
1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 10
Output for 4.4.3
1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 10
Output for 4.3.11
0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 11
Output for 4.3.9
1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 11
Output for 4.3.7
0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 12
Output for 4.3.6
0 is tails 1 is heads 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 1 is heads 1 is heads 1 is heads total flips took is: 24
Output for 4.3.4
0 is tails 0 is tails 1 is heads 1 is heads 0 is tails 1 is heads 0 is tails 1 is heads 0 is tails 0 is tails 0 is tails total flips took is: 11