3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function countOccurrence(int $number, int $digit){ $result = 0; while ($number > 0){ $lastDigit = $number % 10; if($lastDigit === $digit){ $result++; } $number = ($number - $lastDigit)/10; } return $result; } echo countOccurrence(1111,1); // this is fine :) echo PHP_EOL; // just a line-break echo countOccurrence(1111,'1'); // this will throw an error with strict_types=1

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)
8.4.120.0130.00720.57
8.4.110.0050.00322.12
8.4.100.0060.00417.92
8.4.90.0120.00820.50
8.4.80.0050.00319.62
8.4.70.0090.01218.00
8.4.60.0080.01120.58
8.4.50.0100.00719.74
8.4.40.0130.00717.71
8.4.30.0140.00720.70
8.4.20.0160.00319.75
8.4.10.0050.00322.72
8.3.250.0120.00618.58
8.3.240.0140.00516.91
8.3.230.0070.00316.54
8.3.220.0030.00518.76
8.3.210.0120.00816.68
8.3.200.0130.00416.70
8.3.190.0130.00517.29
8.3.180.0090.00716.70
8.3.170.0140.00418.71
8.3.160.0000.01418.23
8.3.150.0070.01120.66
8.3.140.0190.00016.59
8.3.130.0000.00918.43
8.3.120.0130.00719.02
8.3.110.0040.00420.94
8.3.100.0050.00524.06
8.3.90.0080.00026.77
8.3.80.0060.00319.36
8.3.70.0100.01016.88
8.3.60.0100.01018.56
8.3.50.0150.00524.53
8.3.40.0070.01018.84
8.3.30.0070.00718.59
8.3.20.0040.00424.18
8.3.10.0050.00224.66
8.3.00.0030.00526.16
8.2.290.0130.00420.45
8.2.280.0050.00318.48
8.2.270.0150.00417.05
8.2.260.0060.01218.76
8.2.250.0050.00318.27
8.2.240.0060.00317.18
8.2.230.0040.00422.58
8.2.220.0060.00337.54
8.2.210.0100.01026.77
8.2.200.0050.00518.88
8.2.190.0140.00416.88
8.2.180.0100.01325.92
8.2.170.0070.01119.14
8.2.160.0030.01022.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0070.00026.35
8.2.110.0000.00920.38
8.2.100.0120.00017.91
8.2.90.0040.00418.03
8.2.80.0080.00017.97
8.2.70.0050.00317.90
8.2.60.0050.00318.22
8.2.50.0030.00618.10
8.2.40.0050.00319.05
8.2.30.0040.00419.22
8.2.20.0050.00218.10
8.2.10.0000.00819.31
8.2.00.0000.00819.28
8.1.330.0070.01221.92
8.1.320.0130.00716.45
8.1.310.0100.00718.25
8.1.300.0080.00018.53
8.1.290.0030.01030.84
8.1.280.0140.00325.92
8.1.270.0040.00422.14
8.1.260.0070.00028.09
8.1.250.0070.00028.09
8.1.240.0060.00322.09
8.1.230.0110.00022.68
8.1.220.0070.00317.77
8.1.210.0070.00318.77
8.1.200.0060.00317.47
8.1.190.0040.00417.11
8.1.180.0050.00318.10
8.1.170.0080.00018.32
8.1.160.0060.00318.92
8.1.150.0000.00818.81
8.1.140.0040.00420.23
8.1.130.0070.00020.07
8.1.120.0040.00417.28
8.1.110.0000.00717.41
8.1.100.0000.00917.42
8.1.90.0000.00817.43
8.1.80.0030.00617.36
8.1.70.0000.00717.37
8.1.60.0060.00317.44
8.1.50.0000.00817.57
8.1.40.0040.00417.46
8.1.30.0000.00917.68
8.1.20.0000.00817.65
8.1.10.0070.00017.56
8.1.00.0030.00517.48
8.0.300.0030.00619.73
8.0.290.0030.00516.63
8.0.280.0050.00318.51
8.0.270.0030.00316.88
8.0.260.0030.00320.05
8.0.250.0000.00716.96
8.0.240.0060.00317.01
8.0.230.0030.00316.99
8.0.220.0040.00416.90
8.0.210.0040.00416.84
8.0.200.0040.00417.00
8.0.190.0050.00217.02
8.0.180.0000.00816.89
8.0.170.0080.00016.99
8.0.160.0040.00416.87
8.0.150.0000.00716.92
8.0.140.0040.00416.79
8.0.130.0030.00313.39
8.0.120.0080.00016.85
8.0.110.0050.00216.83
8.0.100.0050.00216.96
8.0.90.0070.00016.95
8.0.80.0070.01016.90
8.0.70.0000.00716.76
8.0.60.0050.00317.01
8.0.50.0040.00416.96
8.0.30.0030.02117.13
8.0.20.0090.01017.11
8.0.10.0070.00016.94
8.0.00.0070.01417.11
7.4.330.0050.00015.55
7.4.320.0030.00316.60
7.4.300.0030.00316.64
7.4.290.0040.00416.46
7.4.280.0060.00316.51
7.4.270.0000.00716.53
7.4.260.0000.01013.25
7.4.250.0000.00716.60
7.4.240.0000.00816.52
7.4.230.0030.00316.49
7.4.220.0020.00516.57
7.4.210.0090.01016.54
7.4.200.0030.00316.43
7.4.130.0100.00816.39
7.4.120.0170.00716.52
7.4.110.0070.01016.58
7.4.100.0000.01616.59
7.4.90.0170.00616.38
7.4.80.0000.02116.33
7.4.70.0090.00916.59
7.4.60.0070.01016.49
7.4.50.0030.01516.49
7.4.40.0070.01016.46
7.4.30.0100.00916.52
7.4.20.0130.01616.54
7.4.10.0100.00716.30
7.4.00.0070.01116.62
7.3.330.0000.00716.26
7.3.320.0000.00513.28
7.3.310.0000.00716.39
7.3.300.0000.00716.37
7.3.290.0110.00516.44
7.3.260.0070.01516.52
7.3.230.0130.00316.39
7.3.210.0100.01216.59
7.3.200.0100.01016.45
7.3.190.0110.00616.63
7.3.180.0090.00916.40
7.3.170.0070.01016.57
7.3.160.0110.00516.45
7.3.150.0000.02016.54
7.3.140.0080.00816.60
7.3.130.0080.00816.65
7.3.120.0150.00916.37
7.3.110.0100.00916.40
7.3.100.0130.00616.62
7.3.90.0120.00616.32
7.3.80.0100.00716.27
7.3.70.0180.00316.43
7.3.60.0060.01216.54
7.3.50.0110.00616.52
7.3.40.0170.00016.48
7.3.30.0130.01016.50
7.3.20.0060.01216.45
7.3.10.0000.01916.32
7.3.00.0070.01116.34
7.2.330.0150.00816.48
7.2.320.0100.01116.46
7.2.310.0090.00916.77
7.2.300.0050.01316.70
7.2.290.0090.00816.71
7.2.280.0060.01216.68
7.2.270.0070.01116.55
7.2.260.0170.00016.57
7.2.250.0150.00416.68
7.2.240.0120.00616.66
7.2.230.0140.00416.57
7.2.220.0060.01216.77
7.2.210.0090.00916.49
7.2.200.0060.01816.49
7.2.190.0130.00616.54
7.2.180.0120.01216.52
7.2.170.0120.01216.51
7.2.160.0030.01516.64
7.2.150.0080.01116.70
7.2.140.0140.01016.65
7.2.130.0140.00616.63
7.2.120.0060.01216.66
7.2.110.0270.01216.63
7.2.100.0100.01016.69
7.2.90.0130.00616.79
7.2.80.0140.00916.53
7.2.70.0120.01216.64
7.2.60.0150.00916.66
7.2.50.0070.01716.65
7.2.40.0140.01016.78
7.2.30.0040.01516.56
7.2.20.0080.01116.71
7.2.10.0100.01016.64
7.2.00.0170.00916.63

preferences:
127.03 ms | 403 KiB | 5 Q