3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &drupal_static($name, $default_value = NULL, $reset = FALSE) { static $data = array(), $default = array(); // First check if dealing with a previously defined static variable. if (isset($data [$name]) || array_key_exists($name, $data)) { // Non-NULL $name and both $data[$name] and $default[$name] statics exist. if ($reset) { // Reset pre-existing static variable to its default value. $data [$name] = $default [$name]; } return $data [$name]; } // Neither $data[$name] nor $default[$name] static variables exist. if (isset($name)) { if ($reset) { // Reset was called before a default is set and yet a variable must be // returned. return $data; } // First call with new non-NULL $name. Initialize a new static variable. $default [$name] = $data [$name] = $default_value; return $data [$name]; } // Reset all: ($name == NULL). This needs to be done one at a time so that // references returned by earlier invocations of drupal_static() also get // reset. foreach ($default as $name => $value) { $data [$name] = $value; } // As the function returns a reference, the return should always be a // variable. return $data; } $drupal_static_fast = &drupal_static('foo'); $missing = &$drupal_static_fast['missing']; var_dump(!isset($missing)); $missing = array(); var_dump(!isset($missing));

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.0070.01018.56
8.3.50.0130.00522.11
8.3.40.0000.01418.82
8.3.30.0140.00019.04
8.3.20.0000.00720.33
8.3.10.0000.00821.76
8.3.00.0070.00019.19
8.2.180.0110.01118.11
8.2.170.0110.00422.96
8.2.160.0110.00319.32
8.2.150.0090.00324.18
8.2.140.0030.00524.66
8.2.130.0000.00726.16
8.2.120.0040.00419.67
8.2.110.0030.00721.12
8.2.100.0040.00719.76
8.2.90.0030.00619.76
8.2.80.0060.00318.28
8.2.70.0000.00817.93
8.2.60.0000.00818.16
8.2.50.0040.00418.10
8.2.40.0060.00319.88
8.2.30.0030.00818.20
8.2.20.0000.00817.82
8.2.10.0000.00818.16
8.2.00.0050.00217.74
8.1.280.0090.00625.92
8.1.270.0050.00320.76
8.1.260.0110.00426.35
8.1.250.0040.00428.09
8.1.240.0050.00323.94
8.1.230.0080.00422.82
8.1.220.0000.00817.78
8.1.210.0050.00318.77
8.1.200.0030.00617.35
8.1.190.0040.00417.35
8.1.180.0060.00618.10
8.1.170.0040.00418.59
8.1.160.0000.00721.99
8.1.150.0000.00718.95
8.1.140.0050.00319.30
8.1.130.0000.00717.80
8.1.120.0000.00717.42
8.1.110.0040.00417.44
8.1.100.0000.00717.38
8.1.90.0030.00417.36
8.1.80.0050.00217.37
8.1.70.0040.00417.39
8.1.60.0080.00017.60
8.1.50.0000.00817.48
8.1.40.0040.00417.57
8.1.30.0040.00417.64
8.1.20.0020.00517.68
8.1.10.0000.00817.48
8.1.00.0030.00517.57
8.0.300.0060.00319.63
8.0.290.0040.00416.75
8.0.280.0000.00718.48
8.0.270.0030.00317.25
8.0.260.0030.00317.18
8.0.250.0000.00716.98
8.0.240.0040.00416.83
8.0.230.0040.00416.95
8.0.220.0000.00616.94
8.0.210.0030.00316.89
8.0.200.0030.00316.96
8.0.190.0000.00817.03
8.0.180.0040.00416.84
8.0.170.0000.00816.94
8.0.160.0000.00716.83
8.0.150.0000.00816.85
8.0.140.0040.00416.76
8.0.130.0030.00313.27
8.0.120.0030.00516.90
8.0.110.0050.00216.91
8.0.100.0000.00816.96
8.0.90.0000.00716.76
8.0.80.0130.00316.97
8.0.70.0070.00016.78
8.0.60.0040.00416.88
8.0.50.0000.00716.69
8.0.30.0170.00517.13
8.0.20.0080.00917.45
8.0.10.0000.00716.92
8.0.00.0140.00616.87
7.4.330.0020.00215.09
7.4.320.0000.00716.44
7.4.300.0000.00616.51
7.4.290.0040.00416.43
7.4.280.0040.00716.53
7.4.270.0000.00616.54
7.4.260.0000.00816.59
7.4.250.0040.00416.57
7.4.240.0020.00516.54
7.4.230.0040.00416.41
7.4.220.0130.00416.54
7.4.210.0130.00616.58
7.4.200.0020.00516.62
7.4.160.0030.01716.54
7.4.150.0100.00717.40
7.4.140.0130.01017.86
7.4.130.0110.00516.50
7.4.120.0150.00316.39
7.4.110.0070.01416.44
7.4.100.0060.01216.72
7.4.90.0090.01216.70
7.4.80.0140.00819.39
7.4.70.0120.00816.35
7.4.60.0080.01516.49
7.4.50.0040.00416.65
7.4.40.0130.00716.48
7.4.30.0060.01116.52
7.4.00.0070.00814.91
7.3.330.0000.00713.18
7.3.320.0000.00513.26
7.3.310.0040.00416.25
7.3.300.0030.00316.25
7.3.290.0050.00816.39
7.3.280.0080.00816.43
7.3.270.0070.01017.40
7.3.260.0100.01316.53
7.3.250.0080.00916.46
7.3.240.0100.00716.59
7.3.230.0070.01116.39
7.3.210.0000.01716.30
7.3.200.0140.01019.39
7.3.190.0040.01916.32
7.3.180.0040.01116.36
7.3.170.0120.00916.36
7.3.160.0060.01516.18
7.3.120.0040.01514.45
7.3.110.0090.00915.16
7.3.100.0070.01014.84
7.3.90.0080.00314.69
7.3.80.0030.01314.82
7.3.70.0060.01015.02
7.3.60.0060.00914.88
7.3.50.0030.01014.92
7.3.40.0040.01114.66
7.3.30.0040.01214.77
7.3.20.0030.01616.57
7.3.10.0090.00616.67
7.3.00.0070.01116.58
7.2.330.0070.01016.48
7.2.320.0130.01016.83
7.2.310.0130.00316.48
7.2.300.0090.00916.64
7.2.290.0070.01616.65
7.2.250.0030.01614.82
7.2.240.0070.01414.55
7.2.230.0040.01215.09
7.2.220.0030.01015.14
7.2.210.0090.00615.21
7.2.200.0060.00315.12
7.2.190.0070.00315.08
7.2.180.0040.00814.95
7.2.170.0070.01114.67
7.2.60.0080.00416.89
7.2.00.0000.01419.13
7.1.330.0060.00915.95
7.1.320.0050.00515.92
7.1.310.0030.00915.75
7.1.300.0030.00615.79
7.1.290.0110.00315.68
7.1.280.0160.00315.67
7.1.270.0140.00015.52
7.1.260.0090.00615.69
7.1.200.0050.00215.88
7.1.100.0070.01018.47
7.1.70.0040.00417.29
7.1.60.0140.01019.46
7.1.50.0070.01816.86
7.1.00.0070.07322.36
7.0.200.0030.00616.52
7.0.140.0000.06322.00
7.0.60.0100.03720.08
7.0.50.0030.04717.88
7.0.40.0000.07720.20
7.0.30.0130.04320.24
7.0.20.0230.07720.15
7.0.10.0030.04720.10
7.0.00.0100.05320.07
5.6.280.0000.07720.78
5.6.210.0100.03720.77
5.6.200.0000.04718.25
5.6.190.0070.09020.52
5.6.180.0470.05720.63
5.6.170.0330.05720.55
5.6.160.0100.04320.46
5.6.150.0100.04718.29
5.6.140.0100.07718.18
5.6.130.0100.05318.11
5.6.120.0000.04321.02
5.6.110.0070.08321.05
5.6.100.0070.04020.98
5.6.90.0100.04721.01
5.6.80.0030.05720.54
5.5.350.0330.04020.41
5.5.340.0130.07017.94
5.5.330.0100.04720.43
5.5.320.0070.07720.20
5.5.310.0270.06320.19
5.5.300.0030.08018.00
5.5.290.0100.03318.08
5.5.280.0030.05020.88
5.5.270.0130.05020.85
5.5.260.0070.08720.95
5.5.250.0030.09020.66
5.5.240.0100.06720.35
5.4.450.0600.07019.30
5.4.440.0100.08019.52
5.4.430.0100.05319.54
5.4.420.0100.07719.52
5.4.410.0100.05319.29
5.4.400.0130.05319.22
5.4.390.0200.06018.74
5.4.380.0170.06018.47
5.4.370.0130.06318.63
5.4.360.0270.04718.53
5.4.350.0230.05018.79
5.4.340.0070.07018.75
5.4.320.0270.04718.55
5.4.310.0170.06018.78
5.4.300.0230.07018.83
5.4.290.0130.06018.46
5.4.280.0230.05718.75
5.4.270.0100.08318.80
5.4.260.0030.06718.69
5.4.250.0270.04718.79
5.4.240.0130.05718.60
5.4.230.0130.05718.49
5.4.220.0030.07318.58
5.4.210.0130.05718.52
5.4.200.0130.05716.61
5.4.190.0170.05718.59
5.4.180.0230.04718.70
5.4.170.0100.06018.79
5.4.160.0100.05718.44
5.4.150.0100.06018.58
5.4.140.0100.06016.34
5.4.130.0130.05316.32
5.4.120.0100.05716.19
5.4.110.0170.05016.29
5.4.100.0100.06716.21
5.4.90.0100.05716.21
5.4.80.0270.06016.28
5.4.70.0200.05016.25
5.4.60.0130.05016.39
5.4.50.0230.04716.16
5.4.40.0170.05016.43
5.4.30.0270.05316.22
5.4.20.0130.06016.26
5.4.10.0200.04716.18
5.4.00.0270.04715.71
5.3.290.0100.06314.80
5.3.280.0230.04714.61
5.3.270.0000.07714.74
5.3.260.0200.05014.77
5.3.250.0270.04314.60
5.3.240.0300.05014.81
5.3.230.0170.05014.61
5.3.220.0230.04314.69
5.3.210.0170.06014.58
5.3.200.0270.04314.79
5.3.190.0200.05314.73
5.3.180.0170.05014.77
5.3.170.0170.05714.61
5.3.160.0130.05714.59
5.3.150.0170.05314.78
5.3.140.0200.05714.59
5.3.130.0230.04714.57
5.3.120.0170.05014.71
5.3.110.0300.04714.56
5.3.100.0230.05314.09
5.3.90.0200.05314.20
5.3.80.0170.06014.15
5.3.70.0200.05014.24
5.3.60.0270.04714.13
5.3.50.0270.04314.00
5.3.40.0200.05013.95
5.3.30.0230.06314.04
5.3.20.0070.06713.70
5.3.10.0230.04013.68
5.3.00.0170.05013.66
5.2.170.0070.05011.19
5.2.160.0070.04711.18
5.2.150.0170.04011.25
5.2.140.0270.03011.20
5.2.130.0100.05011.13
5.2.120.0070.04711.31
5.2.110.0200.03711.09
5.2.100.0200.03711.14
5.2.90.0200.03311.30
5.2.80.0070.04711.14
5.2.70.0100.05011.14
5.2.60.0130.04311.28
5.2.50.0170.04011.06
5.2.40.0070.04711.10
5.2.30.0130.04011.00
5.2.20.0130.03711.06
5.2.10.0070.04310.89
5.2.00.0070.04310.82
5.1.60.0100.03310.00
5.1.50.0100.03710.19
5.1.40.0130.0339.98
5.1.30.0100.03710.33
5.1.20.0130.03710.40
5.1.10.0100.03710.28
5.1.00.0030.04310.17
5.0.50.0000.0378.66
5.0.40.0030.0308.47
5.0.30.0070.0438.36
5.0.20.0070.0278.24
5.0.10.0070.0278.28
5.0.00.0100.0408.37
4.4.90.0100.0175.95
4.4.80.0000.0275.93
4.4.70.0000.0305.97
4.4.60.0170.0136.01
4.4.50.0100.0176.04
4.4.40.0030.0375.94
4.4.30.0000.0275.95
4.4.20.0030.0235.98
4.4.10.0130.0206.05
4.4.00.0030.0376.01
4.3.110.0030.0335.91
4.3.100.0030.0235.85
4.3.90.0100.0175.92
4.3.80.0130.0375.79
4.3.70.0030.0235.80
4.3.60.0000.0275.86
4.3.50.0130.0235.82
4.3.40.0130.0375.79
4.3.30.0030.0304.87
4.3.20.0070.0304.87
4.3.10.0030.0234.87
4.3.00.0070.0236.68

preferences:
46.12 ms | 401 KiB | 5 Q