3v4l.org

run code in 300+ PHP versions simultaneously
<!DOCTYPE html> <html> <head> <title>A loop of your own</title> <link type='text/css' rel='stylesheet' href='style.css'/> </head> <body> <?php //Add while loop below echo "<p>We will flip until we have heads.</p>"; $flipCount = 1; $headCount = 0; $tailCount = 0; while($headCount or $tailCount < 3) { $num = rand(0,1); if($num > 0.5) { echo "Heads. "; $headCount ++; $tailCount = 0; } else { echo "Tails. "; $headCount = 0; $tailCount ++; } if($headCount == 3) { echo "Congratulations! You got 3 heads in a row! It took you $flipCount tries."; } elseif($tailCount == 3) { echo "Congratulations! You got 3 tails in a row! It took you $flipCount tries."; } else { echo "No luck yet. You haven't gotten it after $flipCount tries.<br />"; } $flipCount ++; } ?> </body> </html>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.10.0060.01114.81
7.4.00.0030.01414.88
7.3.130.0080.00614.75
7.3.120.0070.00714.52
7.3.110.0130.00314.86
7.3.100.0000.01414.71
7.3.90.0070.00715.06
7.3.80.0030.00915.00
7.3.70.0100.00314.90
7.3.60.0130.00014.76
7.3.50.0000.01414.88
7.3.40.0000.01514.93
7.3.30.0060.01215.02
7.3.20.0130.00016.85
7.3.10.0050.00916.59
7.3.00.0060.00616.67
7.2.260.0040.01515.05
7.2.250.0100.00715.23
7.2.240.0110.00414.75
7.2.230.0030.01014.95
7.2.220.0040.01115.35
7.2.210.0030.01315.15
7.2.200.0140.00015.15
7.2.190.0000.01015.06
7.2.180.0060.00914.73
7.2.170.0060.01015.07
7.2.160.0050.00514.97
7.2.150.0070.00716.94
7.2.140.0090.00016.94
7.2.130.0110.00316.97
7.2.120.0080.01017.08
7.2.110.0110.00316.85
7.2.100.0080.00817.01
7.2.90.0050.00817.00
7.2.80.0050.00716.92
7.2.70.0050.00816.87
7.2.60.0070.01116.97
7.2.50.0050.00816.94
7.2.40.0050.01016.84
7.2.30.0070.00716.91
7.2.20.0080.00816.87
7.2.10.0080.00316.91
7.2.00.0050.00917.94
7.1.330.0030.01115.74
7.1.320.0100.00315.71
7.1.310.0090.00615.94
7.1.300.0040.00415.71
7.1.290.0030.01316.02
7.1.280.0060.00315.82
7.1.270.0100.00315.54
7.1.260.0070.00715.61
7.1.250.0060.00515.76
7.1.240.0120.00015.64
7.1.230.0070.00715.74
7.1.220.0100.00615.78
7.1.210.0040.00815.76
7.1.200.0070.00715.53
7.1.190.0000.01115.86
7.1.180.0100.00715.85
7.1.170.0060.00915.87
7.1.160.0030.00715.88
7.1.150.0120.00315.64
7.1.140.0000.01315.63
7.1.130.0120.00315.55
7.1.120.0050.00515.85
7.1.110.0030.01015.88
7.1.100.0000.01315.80
7.1.90.0090.00015.85
7.1.80.0080.00615.94
7.1.70.0050.00716.35
7.1.60.0090.01217.52
7.1.50.0100.00416.16
7.1.40.0040.01215.91
7.1.30.0060.01215.77
7.1.20.0000.00915.63
7.1.10.0070.00715.87
7.1.00.0020.04419.01
7.0.330.0030.01415.59
7.0.320.0040.01115.49
7.0.310.0060.00615.48
7.0.300.0070.01015.39
7.0.290.0080.00615.48
7.0.280.0000.01015.47
7.0.270.0140.00015.49
7.0.260.0000.01315.04
7.0.250.0040.00815.41
7.0.240.0030.00715.52
7.0.230.0030.00515.23
7.0.220.0040.00715.42
7.0.210.0040.00815.58
7.0.200.0070.00616.11
7.0.190.0090.00615.49
7.0.180.0040.01415.36
7.0.170.0080.00815.31
7.0.160.0060.00615.32
7.0.150.0030.00815.46
7.0.140.0020.04018.73
7.0.130.0070.00715.32
7.0.120.0040.00815.34
7.0.110.0100.00315.50
7.0.100.0070.01015.55
7.0.90.0030.01115.58
7.0.80.0090.00615.55
7.0.70.0030.00915.51
7.0.60.0100.03517.77
7.0.50.0070.02516.67
7.0.40.0020.04916.63
7.0.30.0130.02616.92
7.0.20.0140.04716.89
7.0.10.0120.04616.70
7.0.00.0070.04516.82
5.6.400.0120.00314.27
5.6.390.0000.01114.35
5.6.380.0070.00714.15
5.6.370.0000.01214.24
5.6.360.0070.00714.31
5.6.350.0130.00314.54
5.6.340.0040.00414.38
5.6.330.0030.00814.55
5.6.320.0030.00614.44
5.6.310.0070.00414.47
5.6.300.0030.01314.63
5.6.290.0110.00414.23
5.6.280.0070.03817.50
5.6.270.0060.01014.44
5.6.260.0000.01814.59
5.6.250.0130.00614.48
5.6.240.0060.01214.32
5.6.230.0000.01114.16
5.6.220.0000.01614.36
5.6.210.0070.02617.54
5.6.200.0030.04516.18
5.6.190.0050.04217.30
5.6.180.2120.02517.41
5.6.170.0120.04817.38
5.6.160.0060.02117.30
5.6.150.0100.04016.28
5.6.140.0050.03716.23
5.6.130.0120.03916.29
5.6.120.0060.02617.64
5.6.110.0140.03517.74
5.6.100.0100.03817.74
5.6.90.0050.02317.72
5.6.80.0120.03517.36
5.6.70.2230.02217.27
5.6.60.0090.00614.10
5.6.50.0040.00914.14
5.6.40.0060.00614.55
5.6.30.0040.01114.13
5.6.20.0090.00614.01
5.6.10.0100.00314.42
5.6.00.0080.00814.35
5.5.380.0000.01614.32
5.5.370.0040.00814.04
5.5.360.0070.00314.50
5.5.350.0160.04117.25
5.5.340.0030.03616.12
5.5.330.0050.04617.29
5.5.320.0200.03917.28
5.5.310.0170.03717.38
5.5.300.0070.04316.20
5.5.290.0060.03416.23
5.5.280.0110.02417.66
5.5.270.0140.04217.68
5.5.260.0060.03117.44
5.5.250.0050.02517.48
5.5.240.0090.02717.29
5.5.230.0090.00914.07
5.5.220.0100.00714.06
5.5.210.0070.00714.23
5.5.200.0000.01314.36
5.5.190.0040.00814.05
5.5.180.0090.00914.15
5.5.170.0110.00714.41
5.5.160.0030.01414.32
5.5.150.0000.01914.28
5.5.140.0000.01913.71
5.5.130.0000.01614.33
5.5.120.0130.00714.16
5.5.110.0040.01214.07
5.5.100.0050.00814.31
5.5.90.0030.01314.33
5.5.80.0030.00614.29
5.5.70.0030.01014.29
5.5.60.0030.01314.25
5.5.50.0080.00814.02
5.5.40.0090.00314.32
5.5.30.0090.00614.23
5.5.20.0070.00714.23
5.5.10.0100.00314.24
5.5.00.0060.00614.37
5.4.450.0540.02115.20
5.4.440.0400.02515.13
5.4.430.0080.03014.95
5.4.420.0070.03015.21
5.4.410.0070.03015.20
5.4.400.0110.04015.02
5.4.390.0050.03214.96
5.4.380.0110.03114.88
5.4.370.0090.02514.82
5.4.360.0070.02914.77
5.4.350.0070.01911.33
5.4.340.0070.02411.48
5.4.330.0000.01210.89
5.4.320.0040.02111.75
5.4.310.0020.03011.54
5.4.300.0030.03211.67
5.4.290.0080.03111.71
5.4.280.0030.02611.74
5.4.270.0100.02611.58
5.4.260.0050.03111.51
5.4.250.0020.02711.61
5.4.240.0040.02611.70
5.4.230.0040.02511.65
5.4.220.0090.02711.64
5.4.210.0080.02211.58
5.4.200.0050.02311.60
5.4.190.0030.02411.67
5.4.180.0060.02311.62
5.4.170.0030.02611.66
5.4.160.0070.02211.61
5.4.150.0060.02311.52
5.4.140.0040.02811.31
5.4.130.0050.02111.49
5.4.120.0050.02411.61
5.4.110.0070.02211.35
5.4.100.0050.02211.37
5.4.90.0050.02311.45
5.4.80.0070.02011.57
5.4.70.0070.02211.47
5.4.60.0020.02411.42
5.4.50.0050.02311.39
5.4.40.0040.02411.45
5.4.30.0050.02211.47
5.4.20.0050.02311.38
5.4.10.0020.02611.48
5.4.00.0040.02511.28
5.3.290.0040.02211.59
5.3.280.0060.02111.53
5.3.270.0050.02911.51
5.3.260.0060.03211.60
5.3.250.0050.02911.61
5.3.240.0070.02011.60
5.3.230.0040.02411.58
5.3.220.0070.02411.34
5.3.210.0060.02411.43
5.3.200.0060.02411.45
5.3.190.0060.02711.49
5.3.180.0060.02311.46
5.3.170.0060.02211.54
5.3.160.0050.02411.56
5.3.150.0050.03811.54
5.3.140.0070.03211.53
5.3.130.0090.02911.60
5.3.120.0070.02711.60
5.3.110.0070.03611.48
5.3.100.0080.04211.15
5.3.90.0070.02211.26
5.3.80.0040.02611.07
5.3.70.0070.02111.14
5.3.60.0040.02611.32
5.3.50.0020.02811.12
5.3.40.0080.02511.15
5.3.30.0110.04011.21
5.3.20.0080.02310.93
5.3.10.0020.02210.90
5.3.00.0080.02810.97
5.2.170.0060.0329.18
5.2.160.0110.0439.18
5.2.150.0120.0369.18
5.2.140.0050.0429.18
5.2.130.0100.0309.14
5.2.120.0060.0369.14
5.2.110.0090.0359.14
5.2.100.0050.0339.14
5.2.90.0060.0349.14
5.2.80.0100.0329.13
5.2.70.0030.0349.14
5.2.60.0070.0479.10
5.2.50.0080.0429.06
5.2.40.0090.0319.04
5.2.30.0080.0279.01
5.2.20.0040.0309.02
5.2.10.0030.0308.95
5.2.00.0020.0338.82
5.1.60.0040.0258.10
5.1.50.0070.0238.10
5.1.40.0080.0218.08
5.1.30.0040.0288.43
5.1.20.0050.0258.45
5.1.10.0060.0248.18
5.1.00.0030.0278.17
5.0.50.0010.0236.65
5.0.40.0040.0206.52
5.0.30.0040.0366.32
5.0.20.0040.0276.32
5.0.10.0000.0246.30
5.0.00.0030.0346.28
4.4.90.0040.0154.77
4.4.80.0050.0144.75
4.4.70.0020.0174.75
4.4.60.0040.0144.76
4.4.50.0050.0204.77
4.4.40.0040.0254.71
4.4.30.0030.0154.76
4.4.20.0040.0154.85
4.4.10.0030.0154.85
4.4.00.0030.0244.76
4.3.110.0030.0154.67
4.3.100.0040.0144.67
4.3.90.0040.0144.63
4.3.80.0010.0264.59
4.3.70.0020.0164.63
4.3.60.0030.0154.63
4.3.50.0040.0164.63
4.3.40.0040.0264.54
4.3.30.0000.0193.34
4.3.20.0000.0183.32
4.3.10.0030.0163.27
4.3.00.0000.01715.25

preferences:
45.14 ms | 400 KiB | 5 Q