3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $foo = ["a" => 1, "b" => 2, "c" => 3, "d" => 4]; } $i = 0; $mem = memory_get_usage(); for ($i = 19999; --$i;) { $s[] = new Foo; } $mem = memory_get_usage() - $mem; echo "Memory used with static init: ", $mem, PHP_EOL; class Bar { private $bar; function __construct() { $this->bar = ["a" => 1, "b" => 2, "c" => 3, "d" => 4]; } } $mem = memory_get_usage(); for ($i = 19999; --$i;) { $f[] = new Bar; } $mem = memory_get_usage() - $mem; echo "Memory used with dynamic init: ", $mem, PHP_EOL;

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.00.0130.01618.97
7.3.120.0090.01919.04
7.3.110.0100.01718.98
7.3.100.0100.01718.94
7.3.90.0060.00818.64
7.3.80.0060.01618.90
7.3.70.0030.01718.85
7.3.60.0000.01818.96
7.3.50.0100.01018.44
7.3.40.0070.01118.57
7.3.30.0030.01418.65
7.3.20.0080.01122.57
7.3.10.0030.01322.71
7.3.00.0050.01722.42
7.2.250.0100.02019.28
7.2.240.0070.02419.55
7.2.230.0060.01819.48
7.2.220.0030.01619.40
7.2.210.0060.01219.25
7.2.200.0070.01319.30
7.2.190.0030.01719.00
7.2.180.0090.00919.42
7.2.170.0040.01719.40
7.2.130.0220.00623.21
7.2.120.0140.01023.23
7.2.110.0130.01723.02
7.2.100.0090.00922.95
7.2.90.0120.00922.92
7.2.80.0100.01323.13
7.2.70.0150.00623.21
7.2.60.0100.01322.98
7.2.50.0100.01323.21
7.2.40.0030.01822.88
7.2.30.0040.01823.13
7.2.20.0100.01022.98
7.2.10.0040.01823.16
7.2.00.0100.01124.05
7.1.330.0070.01720.08
7.1.320.0120.00919.69
7.1.310.0100.01319.93
7.1.300.0040.01919.99
7.1.290.0070.01119.96
7.1.280.0060.01620.19
7.1.270.0040.01819.81
7.1.260.0000.02320.14
7.1.250.0090.01220.00
7.1.240.0070.01419.76
7.1.230.0120.00919.68
7.1.220.0150.00620.05
7.1.210.0040.02119.94
7.1.200.0090.01219.94
7.1.190.0060.01519.81
7.1.180.0120.00919.91
7.1.170.0040.01119.77
7.1.160.0060.01519.77
7.1.150.0070.01619.60
7.1.140.0070.01419.75
7.1.130.0090.01220.09
7.1.120.0040.02120.00
7.1.110.0040.02220.02
7.1.100.0070.01720.02
7.1.90.0070.01420.11
7.1.80.0100.01319.99
7.1.70.0070.01120.69
7.1.60.0050.02320.91
7.1.50.0090.01620.44
7.1.40.0030.02119.90
7.1.30.0030.01220.14
7.1.20.0150.00920.12
7.1.10.0130.01019.69
7.1.00.0050.05023.00
7.0.330.0220.02527.80
7.0.320.0160.02227.64
7.0.310.0270.01727.59
7.0.300.0280.01327.79
7.0.290.0200.01327.48
7.0.280.0180.01827.74
7.0.270.0220.01627.54
7.0.260.0190.01627.63
7.0.250.0170.01727.46
7.0.240.0210.01227.74
7.0.230.0100.02427.75
7.0.220.0180.01127.92
7.0.210.0240.01427.69
7.0.200.0240.01926.88
7.0.190.0220.01327.71
7.0.180.0190.01527.43
7.0.170.0290.00727.53
7.0.160.0260.01327.35
7.0.150.0140.02127.62
7.0.140.0160.01927.49
7.0.130.0130.02627.55
7.0.120.0230.01027.67
7.0.110.0190.01927.70
7.0.100.0170.02027.40
7.0.90.0170.01727.68
7.0.80.0180.02427.91
7.0.70.1270.04229.31
7.0.60.1230.04829.33
7.0.50.1140.05129.49
7.0.40.1260.04222.59
7.0.30.1050.05422.58
7.0.20.0950.04922.43
7.0.10.0980.04822.49
7.0.00.1080.04822.63
5.6.380.0100.05440.77
5.6.370.0140.04640.54
5.6.360.0160.04340.96
5.6.350.0230.03940.66
5.6.340.0290.03940.50
5.6.330.0130.05940.65
5.6.320.0170.05240.67
5.6.310.0140.05940.91
5.6.300.0250.04640.58
5.6.290.0130.05440.34
5.6.280.0200.07843.89
5.6.270.0260.04640.16
5.6.260.0160.04940.37
5.6.250.0140.05240.73
5.6.240.0260.04240.33
5.6.230.0170.05340.73
5.6.220.0830.07943.66
5.6.210.0890.08843.58
5.6.200.0760.09244.03
5.6.190.0300.07343.87
5.6.180.0630.08543.83
5.6.170.0770.08043.91
5.6.160.0750.07643.94
5.6.150.0700.07143.70
5.6.140.0630.07543.99
5.6.130.0580.07943.95
5.6.120.0600.07243.74
5.6.110.0300.08643.84
5.6.100.0490.07943.85
5.6.90.0750.07744.01
5.6.80.0570.08543.56
5.6.70.0660.08143.70
5.6.60.0800.06943.65
5.6.50.0530.08543.63
5.6.40.0620.08443.60
5.6.30.0620.08143.55
5.6.20.0720.08243.67
5.6.10.0670.08343.57
5.6.00.0650.08043.55
5.5.380.0130.04437.41
5.5.370.0070.05337.07
5.5.360.0620.07342.06
5.5.350.0720.08942.12
5.5.340.0570.09242.21
5.5.330.0700.08242.30
5.5.320.0930.10742.15
5.5.310.0860.07442.04
5.5.300.0710.07342.15
5.5.290.0480.07742.16
5.5.280.0880.07242.23
5.5.270.0700.08342.32
5.5.260.0630.08242.29
5.5.250.0680.07542.20
5.5.240.0480.07241.78
5.5.230.0620.08741.87
5.5.220.0780.07441.93
5.5.210.0680.07941.80
5.5.200.0650.08041.92
5.5.190.0730.07641.88
5.5.180.0850.06741.82
5.5.170.0070.05537.30
5.5.160.0850.06541.92
5.5.150.0620.08141.91
5.5.140.0610.07441.79
5.5.130.0670.07541.96
5.5.120.0650.08541.93
5.5.110.0520.07341.87
5.5.100.0430.08141.99
5.5.90.0670.06941.90
5.5.80.0730.07441.70
5.5.70.0750.08941.79
5.5.60.0850.08741.71
5.5.50.0730.07441.95
5.5.40.0630.07641.85
5.5.30.0720.07041.92
5.5.20.0730.07641.86
5.5.10.0760.08341.87
5.5.00.0810.09841.74

preferences:
47.84 ms | 401 KiB | 5 Q