3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attempts = 100000; $test = 1; if (true || $test == 1) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = array( 'id' => 27, 'name' => 'Pepe' ); } $end = microtime(true); echo 'Array: ' . ($end - $start) . " <br />\n"; } if (true || $test == 2) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = new stdClass(); $user->id = 27; $user->name = 'Pepe'; } $end = microtime(true); echo 'Object: ' . ($end - $start) . " <br />\n"; } if (true || $test == 3) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = (object) array( 'id' => 27, 'name' => 'Pepe' ); } $end = microtime(true); echo 'Cast: ' . ($end - $start) . " <br />\n"; }

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.0100.03814.88
7.3.120.0060.04514.92
7.3.110.0100.04014.59
7.3.100.0030.04315.03
7.3.90.0070.04014.97
7.3.80.0070.02615.20
7.3.70.0030.03014.71
7.3.60.0040.02914.95
7.3.50.0030.02814.94
7.3.40.0120.02514.62
7.3.30.0070.02614.80
7.3.20.0030.03716.80
7.3.10.0040.02916.61
7.3.00.0000.03416.77
7.2.250.0100.04514.75
7.2.240.0130.04315.20
7.2.230.0060.04514.97
7.2.220.0000.04615.14
7.2.210.0030.03714.98
7.2.200.0120.02514.80
7.2.190.0070.03015.04
7.2.180.0030.03315.05
7.2.170.0100.04015.07
7.2.00.0030.04019.70
7.1.330.0030.04815.80
7.1.320.0100.04415.75
7.1.310.0100.04415.92
7.1.300.0060.04315.76
7.1.290.0030.04515.94
7.1.280.0070.04715.80
7.1.270.0070.04815.78
7.1.260.0000.05315.50
7.1.70.0030.04217.16
7.1.60.0130.05019.46
7.1.50.0030.05617.02
7.1.00.0000.10722.53
7.0.200.0000.03316.56
7.0.140.0030.11722.00
7.0.60.0100.11319.93
7.0.50.0070.10317.91
7.0.40.0070.07720.04
7.0.30.0230.10720.00
7.0.20.0200.08720.12
7.0.10.0070.06320.20
7.0.00.0070.10020.08
5.6.280.0030.17021.11
5.6.210.0100.12320.47
5.6.200.0100.14718.12
5.6.190.0070.10320.41
5.6.180.0100.09320.61
5.6.170.0270.14720.52
5.6.160.0030.09720.33
5.6.150.0100.15318.12
5.6.140.0070.13018.18
5.6.130.0100.09318.18
5.6.120.0030.13721.04
5.6.110.0030.14321.12
5.6.100.0000.12321.14
5.6.90.0070.14720.97
5.6.80.0030.11720.41
5.5.350.4270.08720.33
5.5.340.0070.16017.97
5.5.330.0100.12320.29
5.5.320.0230.15320.29
5.5.310.0300.13320.26
5.5.300.0000.10717.95
5.5.290.0130.12018.05
5.5.280.0070.11020.97
5.5.270.0100.10020.79
5.5.260.0130.14720.76
5.5.250.0030.10020.66
5.5.240.0100.15020.29
5.4.450.0600.15049.64
5.4.440.0300.14041.42
5.4.430.0370.11735.21
5.4.420.0500.11732.53
5.4.410.0400.12731.52
5.4.400.0130.12326.82
5.4.390.0300.13024.76
5.4.380.0370.15018.70
5.4.370.0470.21318.50
5.4.360.0300.15718.49
5.4.350.0470.21718.70
5.4.340.0430.21018.68
5.4.320.0050.10112.46
5.4.310.0070.10012.46
5.4.300.0080.13312.46
5.4.290.0040.14812.46
5.4.280.0080.12312.36
5.4.270.0100.17012.36
5.4.260.0080.14912.36
5.4.250.0110.11812.36
5.4.240.0100.11512.36
5.4.230.0060.12312.35
5.4.220.0090.19912.35
5.4.210.0100.18812.35
5.4.200.0100.18812.35
5.4.190.0080.18712.34
5.4.180.0120.18412.34
5.4.170.0210.17912.36
5.4.160.0220.16812.35
5.4.150.0210.16812.35
5.4.140.0240.15512.03
5.4.130.0120.10212.02
5.4.120.0080.11211.98
5.4.110.0100.10711.97
5.4.100.0060.11911.98
5.4.90.0050.12811.98
5.4.80.0070.12811.97
5.4.70.0090.13611.97
5.4.60.0070.12511.97
5.4.50.0100.12611.97
5.4.40.0060.12711.96
5.4.30.0090.23111.96
5.4.20.0110.18511.95
5.4.10.0110.18111.96
5.4.00.0140.21811.45
5.3.290.0060.12012.80
5.3.280.0110.17812.71
5.3.270.0080.20012.72
5.3.260.0100.21812.71
5.3.250.0080.22712.72
5.3.240.0080.21212.72
5.3.230.0030.20012.71
5.3.220.0050.12912.68
5.3.210.0090.14612.68
5.3.200.0100.13012.68
5.3.190.0070.14112.68
5.3.180.0110.15112.67
5.3.170.0120.16012.67
5.3.160.0080.16912.67
5.3.150.0170.19812.67
5.3.140.0130.17512.66
5.3.130.0090.16212.66
5.3.120.0070.15612.66
5.3.110.0090.17512.66
5.3.100.0170.23312.12
5.3.90.0120.19112.08
5.3.80.0140.21312.07
5.3.70.0070.15712.07
5.3.60.0050.16912.06
5.3.50.0090.15212.00
5.3.40.0070.16912.00
5.3.30.0070.21511.96
5.3.20.0090.20111.74
5.3.10.0260.19711.71
5.3.00.0270.19311.69
5.2.170.0120.2259.20
5.2.160.0080.2309.20
5.2.150.0060.2169.20
5.2.140.0070.1369.20
5.2.130.0070.1249.16
5.2.120.0100.1409.16
5.2.110.0090.1469.16
5.2.100.0090.1589.16
5.2.90.0040.1629.15
5.2.80.0070.1419.16
5.2.70.0080.1679.16
5.2.60.0080.1509.11
5.2.50.0050.1879.07
5.2.40.0070.1509.05
5.2.30.0060.2099.03
5.2.20.0080.2089.02
5.2.10.0070.1518.97
5.2.00.0120.1708.83
5.1.60.0040.1608.11
5.1.50.0070.1758.11
5.1.40.0050.1248.09
5.1.30.0050.1348.45
5.1.20.0080.1088.46
5.1.10.0040.1128.19
5.1.00.0040.1178.18
5.0.50.0040.2086.67
5.0.40.0040.2236.54
5.0.30.0030.1916.34
5.0.20.0020.1886.31
5.0.10.0040.1856.29
5.0.00.0060.2336.29
4.4.90.0080.2194.78
4.4.80.0060.1894.75
4.4.70.0060.1814.75
4.4.60.0030.1734.76
4.4.50.0050.1854.77
4.4.40.0030.1864.71
4.4.30.0000.1814.76
4.4.20.0030.1904.85
4.4.10.0060.1864.84
4.4.00.0060.2044.76
4.3.110.0050.2174.67
4.3.100.0020.1714.67
4.3.90.0060.1944.63
4.3.80.0040.2584.60
4.3.70.0060.1924.63
4.3.60.0050.1804.63
4.3.50.0070.2224.63
4.3.40.0020.2004.54
4.3.30.0040.1653.35
4.3.20.0030.1793.33
4.3.10.0230.2413.29
4.3.00.0000.15723.78

preferences:
51.88 ms | 401 KiB | 5 Q