3v4l.org

run code in 300+ PHP versions simultaneously
<?php # http://scribu.net/blog/defaultdict-in-php.html class Defaultdict implements ArrayAccess { private $container = array(); private $default; public function __construct( $default ) { $this->default = $default; } public function offsetSet( $offset, $value ) { if ( is_null($offset) ) { trigger_error( sprintf( "Trying to use %s as a list.", __CLASS__ ), E_USER_WARNING ); return; } $this->container[$offset] = $value; } public function offsetExists( $offset ) { return true; } public function offsetUnset( $offset ) { unset( $this->container[$offset] ); } public function &offsetGet( $offset ) { if ( !isset( $this->container[$offset] ) ) { if ( is_callable($this->default) ) $value = call_user_func( $this->default, $offset ); else $value = $this->default; $this->container[$offset] = $value; } return $this->container[$offset]; } } $counts = new Defaultdict(1); $counts['English']++; echo $counts['English'];

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.3.60.0040.01216.63
8.3.50.0090.00621.99
8.3.40.0120.00318.96
8.3.30.0140.00018.84
8.3.20.0080.00021.78
8.3.10.0040.00421.73
8.3.00.0040.00419.38
8.2.180.0110.01118.66
8.2.170.0100.00622.96
8.2.160.0070.00720.38
8.2.150.0000.00824.18
8.2.140.0030.00524.66
8.2.130.0080.00019.95
8.2.120.0040.00426.35
8.2.110.0060.00322.24
8.2.100.0110.00317.84
8.2.90.0050.00317.75
8.2.80.0000.00818.81
8.2.70.0070.00317.93
8.2.60.0080.00018.34
8.2.50.0050.00219.27
8.2.40.0040.00419.39
8.2.30.0000.00819.27
8.2.20.0040.00418.01
8.2.10.0040.00418.06
8.2.00.0040.00417.74
8.1.280.0070.01025.92
8.1.270.0050.00220.25
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0080.00023.93
8.1.230.0110.00017.83
8.1.220.0040.00417.76
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0000.00817.22
8.1.180.0050.00319.02
8.1.170.0030.00620.50
8.1.160.0070.00018.82
8.1.150.0000.00720.26
8.1.140.0060.00319.51
8.1.130.0030.00318.99
8.1.120.0020.00517.45
8.1.110.0030.00517.34
8.1.100.0000.00717.42
8.1.90.0000.00717.52
8.1.80.0040.00417.53
8.1.70.0070.00317.46
8.1.60.0000.00817.63
8.1.50.0030.00617.39
8.1.40.0000.00817.54
8.1.30.0000.00817.64
8.1.20.0060.00317.72
8.1.10.0040.00417.50
8.1.00.0040.00417.42
8.0.300.0070.00018.84
8.0.290.0060.00316.58
8.0.280.0080.00018.51
8.0.270.0050.00217.21
8.0.260.0000.00719.01
8.0.250.0030.00317.04
8.0.240.0070.00016.88
8.0.230.0000.00716.86
8.0.220.0000.00716.80
8.0.210.0070.00016.95
8.0.200.0000.00817.02
8.0.190.0060.00616.95
8.0.180.0040.00416.82
8.0.170.0040.00416.83
8.0.160.0050.00216.91
8.0.150.0000.00816.84
8.0.140.0040.00416.85
8.0.130.0060.00013.28
8.0.120.0000.00716.74
8.0.110.0000.00716.74
8.0.100.0070.00016.78
8.0.90.0040.00416.89
8.0.80.0060.00916.87
8.0.70.0070.00016.81
8.0.60.0000.00716.93
8.0.50.0040.00416.89
8.0.30.0070.01217.21
8.0.20.0110.00917.40
8.0.10.0070.00017.05
8.0.00.0190.00616.80
7.4.330.0040.00015.55
7.4.320.0000.00616.38
7.4.300.0060.00016.66
7.4.290.0000.00716.53
7.4.280.0040.00416.52
7.4.270.0030.00316.64
7.4.260.0070.00016.50
7.4.250.0000.00816.59
7.4.240.0050.00216.45
7.4.230.0030.00616.60
7.4.220.0100.01316.65
7.4.210.0080.01216.65
7.4.200.0000.00716.27
7.4.160.0110.00816.36
7.4.150.0100.00917.40
7.4.140.0160.00517.86
7.4.130.0090.00716.51
7.4.120.0120.00716.46
7.4.110.0140.00616.51
7.4.100.0090.00916.61
7.4.90.0150.00916.42
7.4.80.0100.00719.03
7.4.70.0050.01116.59
7.4.60.0030.01216.50
7.4.50.0090.00616.37
7.4.40.0150.00616.55
7.4.30.0030.01516.39
7.4.00.0080.00715.06
7.3.330.0060.00013.34
7.3.320.0000.00513.39
7.3.310.0000.00716.38
7.3.300.0070.00016.35
7.3.290.0070.00916.34
7.3.280.0100.00916.36
7.3.270.0130.01017.40
7.3.260.0090.00916.38
7.3.250.0100.00616.50
7.3.240.0070.01116.62
7.3.230.0100.00716.44
7.3.210.0110.00516.69
7.3.200.0100.01016.50
7.3.190.0060.01516.32
7.3.180.0120.00916.43
7.3.170.0130.00316.61
7.3.160.0130.00616.51
7.3.120.0090.00614.72
7.3.110.0090.00914.61
7.3.100.0040.01115.05
7.3.90.0090.00615.11
7.3.80.0090.00615.02
7.3.70.0060.00614.96
7.3.60.0030.01014.86
7.3.50.0040.00714.49
7.3.40.0030.00914.88
7.3.30.0060.00614.47
7.3.20.0000.01316.55
7.3.10.0000.00916.77
7.3.00.0060.00316.72
7.2.330.0090.00916.94
7.2.320.0080.00816.82
7.2.310.0110.00616.52
7.2.300.0050.01916.89
7.2.290.0120.00616.29
7.2.250.0070.01415.17
7.2.240.0070.01415.32
7.2.230.0030.01215.23
7.2.220.0040.01214.80
7.2.210.0110.00415.10
7.2.200.0120.00315.03
7.2.190.0030.00615.11
7.2.180.0070.00715.15
7.2.170.0030.01015.11
7.1.330.0100.00315.79
7.1.320.0080.00615.90
7.1.310.0040.00815.67
7.1.300.0030.00715.89
7.1.290.0000.01215.79
7.1.280.0050.00515.77
7.1.270.0000.01215.57
7.1.260.0110.00415.53
7.1.200.0030.01015.84
7.1.70.0030.00517.24
7.1.60.0030.00917.22
7.1.10.0130.05322.30
7.1.00.0130.06022.26
7.0.200.0060.00916.52
7.0.150.0130.05021.87
7.0.140.0070.06021.82
7.0.130.0070.05721.88
7.0.120.0130.05021.79
7.0.110.0030.06321.94
7.0.100.0000.06021.91
7.0.90.0070.05721.82
7.0.80.0100.05321.82
7.0.70.0170.05721.86
7.0.60.0030.08021.92
7.0.50.0000.07021.94
7.0.40.0030.06321.85
7.0.30.0100.05021.88
7.0.20.0000.06021.86
7.0.10.0170.04321.77
7.0.00.0130.04721.85

preferences:
40.57 ms | 401 KiB | 5 Q