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']++; print_r(array_keys($counts));

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.20.0090.00919.81
8.4.10.0060.00317.80
8.3.150.0130.00618.62
8.3.140.0030.00517.18
8.3.130.0000.01018.73
8.3.120.0040.00418.84
8.3.110.0080.00020.94
8.3.100.0030.00524.06
8.3.90.0130.00626.77
8.3.80.0030.00618.43
8.3.70.0040.01116.63
8.3.60.0130.00716.63
8.3.50.0310.00322.03
8.3.40.0120.00318.67
8.3.30.0070.00718.83
8.3.20.0090.00021.92
8.3.10.0080.00021.76
8.3.00.0060.00319.63
8.2.270.0070.01117.23
8.2.260.0060.01317.07
8.2.250.0000.00816.57
8.2.240.0060.00317.26
8.2.230.0030.01322.58
8.2.220.0030.00637.54
8.2.210.0050.00326.77
8.2.200.0000.00916.63
8.2.190.0040.01116.88
8.2.180.0100.01318.16
8.2.170.0070.00722.96
8.2.160.0080.00622.21
8.2.150.0110.00724.18
8.2.140.0080.00024.66
8.2.130.0000.00818.21
8.2.120.0040.00426.35
8.2.110.0090.00019.45
8.2.100.0080.00418.03
8.2.90.0040.00417.88
8.2.80.0000.00817.97
8.2.70.0040.00418.04
8.2.60.0080.00018.28
8.2.50.0000.00818.10
8.2.40.0070.00020.61
8.2.30.0040.00419.23
8.2.20.0040.00418.17
8.2.10.0000.00819.78
8.2.00.0000.00717.68
8.1.310.0050.00318.35
8.1.300.0110.00718.22
8.1.290.0060.00330.84
8.1.280.0030.01425.92
8.1.270.0050.00220.20
8.1.260.0060.00326.35
8.1.250.0030.00528.09
8.1.240.0030.00621.37
8.1.230.0120.00319.22
8.1.220.0030.00617.78
8.1.210.0000.00818.77
8.1.200.0000.00917.36
8.1.190.0040.00417.22
8.1.180.0000.00918.10
8.1.170.0060.00318.78
8.1.160.0040.00418.95
8.1.150.0040.00420.28
8.1.140.0040.00419.60
8.1.130.0040.00418.94
8.1.120.0020.00517.50
8.1.110.0000.00717.36
8.1.100.0040.00417.44
8.1.90.0000.00917.36
8.1.80.0040.00417.40
8.1.70.0000.00917.51
8.1.60.0000.00717.51
8.1.50.0030.00617.54
8.1.40.0000.00717.60
8.1.30.0080.00017.57
8.1.20.0000.00817.57
8.1.10.0000.00817.48
8.1.00.0030.00517.54
8.0.300.0080.00019.57
8.0.290.0040.00416.88
8.0.280.0030.00318.35
8.0.270.0000.00717.26
8.0.260.0000.00719.05
8.0.250.0050.00216.93
8.0.240.0000.00617.01
8.0.230.0070.00017.09
8.0.220.0000.00717.03
8.0.210.0070.00016.96
8.0.200.0060.00017.05
8.0.190.0050.00317.00
8.0.180.0030.00516.98
8.0.170.0050.00317.01
8.0.160.0050.00316.97
8.0.150.0040.00416.87
8.0.140.0070.00016.89
8.0.130.0060.00013.41
8.0.120.0040.00416.87
8.0.110.0030.00616.82
8.0.100.0030.00616.99
8.0.90.0070.00016.81
8.0.80.0120.00316.98
8.0.70.0000.00716.93
8.0.60.0000.00716.93
8.0.50.0000.00816.84
8.0.30.0110.00817.12
8.0.20.0090.01117.40
8.0.10.0000.00716.95
8.0.00.0100.01316.66
7.4.330.0050.00015.55
7.4.320.0000.00616.54
7.4.300.0060.00016.60
7.4.290.0000.00716.66
7.4.280.0050.00216.66
7.4.270.0030.00316.66
7.4.260.0000.00716.45
7.4.250.0000.00816.64
7.4.240.0040.00416.42
7.4.230.0040.00416.41
7.4.220.0120.01216.47
7.4.210.0060.01316.48
7.4.200.0030.00316.51
7.4.160.0080.00816.39
7.4.150.0060.01217.40
7.4.140.0140.00517.86
7.4.130.0110.00616.59
7.4.120.0110.00816.56
7.4.110.0190.00916.63
7.4.100.0120.00916.59
7.4.90.0160.00616.69
7.4.80.0100.00718.80
7.4.70.0130.00316.37
7.4.60.0120.00416.54
7.4.50.0070.00316.54
7.4.40.0060.01216.45
7.4.30.0170.00816.49
7.4.00.0070.00914.96
7.3.330.0050.00013.43
7.3.320.0050.00013.44
7.3.310.0040.00416.38
7.3.300.0040.00416.32
7.3.290.0080.00616.41
7.3.280.0080.00916.40
7.3.270.0090.01217.40
7.3.260.0100.00816.46
7.3.250.0110.00716.49
7.3.240.0090.00916.47
7.3.230.0080.01216.63
7.3.210.0070.01016.54
7.3.200.0060.01119.39
7.3.190.0080.00816.49
7.3.180.0080.00916.53
7.3.170.0090.01216.50
7.3.160.0100.01316.46
7.3.120.0030.01614.93
7.3.110.0090.00614.76
7.3.100.0060.00914.98
7.3.90.0040.01114.59
7.3.80.0000.01214.93
7.3.70.0060.00314.86
7.3.60.0100.00314.86
7.3.50.0100.00714.58
7.3.40.0040.00714.93
7.3.30.0110.00314.84
7.3.20.0120.00016.69
7.3.10.0060.00916.73
7.3.00.0050.00816.63
7.2.330.0030.01316.77
7.2.320.0030.02016.89
7.2.310.0140.00316.69
7.2.300.0070.01516.79
7.2.290.0060.01116.67
7.2.250.0090.00614.83
7.2.240.0030.01414.77
7.2.230.0080.00814.99
7.2.220.0070.01015.06
7.2.210.0040.01114.86
7.2.200.0060.01015.02
7.2.190.0140.00014.86
7.2.180.0000.01614.82
7.2.170.0030.00714.67
7.2.130.0070.00716.63
7.2.120.0100.00717.04
7.2.110.0060.00916.93
7.2.100.0070.00716.73
7.2.90.0090.00317.14
7.2.80.0040.01116.87
7.2.70.0030.00716.83
7.2.60.0100.00816.79
7.2.50.0120.00416.79
7.2.40.0060.00316.66
7.2.30.0070.01016.98
7.2.20.0040.01116.97
7.2.10.0040.01216.73
7.2.00.0020.01118.35
7.1.330.0110.00415.80
7.1.320.0030.00615.66
7.1.310.0050.00515.74
7.1.300.0030.01215.75
7.1.290.0040.01215.54
7.1.280.0080.00315.84
7.1.270.0070.01015.57
7.1.260.0100.00315.94
7.1.250.0130.00015.80
7.1.200.0270.00015.27
7.1.100.0050.00518.34
7.1.70.0080.00017.01
7.1.60.0000.01117.19
7.1.50.0000.01517.07
7.1.10.0070.06022.20
7.1.00.0030.06022.42
7.0.200.0000.01716.78
7.0.150.0000.06321.99
7.0.140.0100.05321.82
7.0.130.0030.05721.90
7.0.120.0030.06021.81
7.0.110.0000.06321.78
7.0.100.0130.05021.77
7.0.90.0030.06021.71
7.0.80.0130.05021.78
7.0.70.0030.06021.81
7.0.60.0000.07721.84
7.0.50.0100.05021.89
7.0.40.0070.05321.83
7.0.30.0070.05321.89
7.0.20.0100.05021.87
7.0.10.0070.05721.88
7.0.00.0130.04721.87

preferences:
70.86 ms | 403 KiB | 5 Q