3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php phpversion >= "7.0.0" or die(); $a = 5; $n = 2; echo $a % $n,"\n"; //echo mod($a,$n),"\n"; PHP doesn't have mod() but does have fmod(); see http://php.net/fmod echo fmod((float)$a,(float)$n),"\n"; echo $a - ($n * (int)($a/$n)),"\n"; $a = INF; $n = pow(2.,64.); try{ echo $a % $n,"\n"; } catch (Error $e){ echo $e->getMessage(),"\n"; } echo fmod((float)$a,(float)$n),"\n"; echo $a - ($n * (int)($a/$n)),"\n";
based on T8DWQ

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.10.0030.01016.73
7.3.00.0060.00617.14
7.2.130.0060.00917.19
7.2.120.0140.00017.24
7.2.110.0000.01417.13
7.2.100.0070.00717.18
7.2.90.0060.00917.25
7.2.80.0000.01617.14
7.2.70.0000.01817.23
7.2.60.0080.00616.82
7.2.50.0080.00817.23
7.2.40.0110.00817.06
7.2.30.0040.01217.26
7.2.20.0080.00817.10
7.2.10.0070.01016.89
7.2.00.0050.00918.20
7.1.250.0000.01215.64
7.1.240.0030.00715.76
7.1.230.0030.00715.92
7.1.220.0050.00315.90
7.1.210.0030.01015.91
7.1.200.0040.00515.75
7.1.190.0070.00415.68
7.1.180.0050.00515.67
7.1.170.0030.00915.87
7.1.160.0000.00915.80
7.1.150.0100.00316.03
7.1.140.0030.01216.01
7.1.130.0120.00416.05
7.1.120.0000.01115.96
7.1.110.0060.00916.15
7.1.100.0080.00617.12
7.1.90.0040.00815.97
7.1.80.0030.00715.78
7.1.70.0060.00516.69
7.1.60.0060.01217.54
7.1.50.0070.00516.61
7.1.40.0030.00616.02
7.1.30.0040.01115.64
7.1.20.0030.00615.85
7.1.10.0000.00915.82
7.1.00.0070.04219.21
7.0.330.0030.00715.45
7.0.320.0090.00315.52
7.0.310.0000.01315.65
7.0.300.0060.00615.63
7.0.290.0000.01715.51
7.0.280.0040.01115.57
7.0.270.0060.00615.66
7.0.260.0000.01115.55
7.0.250.0070.00715.41
7.0.240.0040.01115.66
7.0.230.0100.00615.67
7.0.220.0120.00015.66
7.0.210.0070.00715.72
7.0.200.0070.00416.29
7.0.190.0070.01015.32
7.0.180.0120.00315.57
7.0.170.0030.00915.60
7.0.160.0040.01115.90
7.0.150.0030.00715.77
7.0.140.0050.00815.68
7.0.130.0080.00815.46
7.0.120.0090.00015.81
7.0.110.0070.00415.69
7.0.100.0000.01315.36
7.0.90.0040.00815.78
7.0.80.0000.01215.34
7.0.70.0080.00415.45
7.0.60.0030.02517.85
7.0.50.0100.04016.90
7.0.40.0050.03617.02
7.0.30.0200.03817.10
7.0.20.0180.04317.17
7.0.10.0070.04716.89
7.0.00.0020.04716.82
5.6.380.0050.00514.32
5.6.370.0040.00714.86
5.6.360.0030.01014.13
5.6.350.0100.00314.53
5.6.340.0000.00914.52
5.6.330.0070.00714.58
5.6.320.0060.00314.46
5.6.310.0060.00614.76
5.6.300.0080.00614.52
5.6.290.0060.00314.47
5.6.280.0010.02317.78
5.6.270.0110.00314.58
5.6.260.0030.01014.46
5.6.250.0090.00414.62
5.6.240.0030.01014.77
5.6.230.0040.00414.45
5.6.220.0100.00314.27
5.6.210.0080.04117.78
5.6.200.0080.02016.50
5.6.190.0070.04517.38
5.6.180.0190.02517.40
5.6.170.0200.03617.59
5.6.160.0030.04617.59
5.6.150.0030.02816.25
5.6.140.0060.04816.34
5.6.130.0080.04016.28
5.6.120.0050.04717.75
5.6.110.0060.02417.79
5.6.100.0070.04517.79
5.6.90.0060.04817.79
5.6.80.0130.03817.61
5.6.70.0030.01314.48
5.6.60.0060.00614.29
5.6.50.0080.00514.70
5.6.40.0070.00314.30
5.6.30.0040.01114.38
5.6.20.0100.00314.68
5.6.10.0040.00414.50
5.6.00.0080.00514.40
5.5.380.0100.00311.40
5.5.370.0040.00811.28
5.5.360.0000.01311.11
5.5.350.0060.01815.98
5.5.340.0040.04614.65
5.5.330.0070.04415.73
5.5.320.0080.04015.73
5.5.310.0230.03815.91
5.5.300.0030.02814.63
5.5.290.0020.04614.69
5.5.280.0070.04215.88
5.5.270.0020.02516.12
5.5.260.0050.05116.14
5.5.250.0050.04516.02
5.5.240.0160.02515.96
5.5.230.0060.00611.05
5.5.220.0000.01311.27
5.5.210.0030.00611.29
5.5.200.0060.00311.30
5.5.190.0090.00311.01
5.5.180.0030.00711.18
5.5.170.0060.00611.12
5.5.160.0050.00510.81
5.5.150.0030.00311.34
5.5.140.0000.00910.87
5.5.130.0060.00610.94
5.5.120.0030.00711.08
5.5.110.0070.00711.33
5.5.100.0100.00310.73
5.5.90.0040.00911.22
5.5.80.0030.00710.98
5.5.70.0000.01211.11
5.5.60.0030.00311.17
5.5.50.0060.00610.75
5.5.40.0000.00610.96
5.5.30.0030.00311.22
5.5.20.0090.00311.21
5.5.10.0030.00310.93
5.5.00.0040.00811.22
5.4.450.0830.07019.63
5.4.440.0630.06019.42
5.4.430.0870.05319.28
5.4.420.0600.05719.58
5.4.410.0870.06019.63
5.4.400.0900.05019.49
5.4.390.0700.05319.49
5.4.380.0770.04318.95
5.4.370.0730.04319.28
5.4.360.0630.06319.11
5.4.350.0800.05719.48
5.4.340.0900.04719.49
5.4.320.0830.05319.46
5.4.310.0970.06319.46
5.4.300.0900.04319.48
5.4.290.0930.05719.44
5.4.280.0870.04719.37
5.4.270.0830.05319.26
5.4.260.0870.04719.48
5.4.250.0900.04719.41
5.4.240.0900.04319.32
5.4.230.0800.05319.32
5.4.220.0900.04718.97
5.4.210.0800.05319.10
5.4.200.0830.05319.25
5.4.190.1030.05319.25
5.4.180.0970.05018.95
5.4.170.0470.04318.97
5.4.160.0630.05719.46
5.4.150.0800.05018.98
5.4.140.0670.05716.65
5.4.130.0800.04016.58
5.4.120.0770.04316.53
5.4.110.0630.05716.78
5.4.100.1070.03316.33
5.3.290.0730.06014.71
5.3.280.0870.04714.62
5.3.270.0630.06014.77
5.3.260.0900.05014.63
5.3.250.0800.05314.68
5.3.240.0970.04014.67
5.3.230.0830.05014.88
5.3.220.0500.05314.59
5.3.210.0730.04714.59
5.3.200.0800.05014.70