3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Script showing that reset() takes its parameter by reference */ if (defined('HHVM_VERSION')) { exit; } // adapted from http://php.net/manual/en/language.references.php#99644 $g_refcount_added = 0; function refcount($var) { ob_start(); debug_zval_dump($var); $dump = ob_get_clean(); $matches = array(); preg_match('/refcount\(([0-9]+)/', $dump, $matches); $count = $matches[1]; global $g_refcount_added; return $count - $g_refcount_added; } // configure our refcount function $array = array('key' => 'value'); $refcount_expected = 1; $refcount_actual = refcount($array); // 3 in PHP 7.0, 4 in other versions $g_refcount_added = $refcount_actual - $refcount_expected; unset($refcount_actual, $refcount_expected, $array); // end of configure our refcount function function print_refcounts($label, $orig_rc, $copy_rc = null) { if ($copy_rc === null) { printf("%s : orig %d %s (%s)\n", $label, $orig_rc, " ", 'alone'); } else { printf("%s : orig %d, copy %d (%s)\n", $label, $orig_rc, $copy_rc, $copy_rc > 1 ? 'sharing' : 'separated'); } } $orig = array('foo' => 'bar'); print_refcounts("initially ", refcount($orig)); $copy = $orig; print_refcounts("after copy", refcount($orig), refcount($copy)); reset($copy); // if the argument is passed by reference, PHP separates $copy and $orig print_refcounts("after call", refcount($orig), refcount($copy));

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.0160.00018.68
8.3.50.0110.01116.33
8.3.40.0090.00618.82
8.3.30.0110.00419.05
8.3.20.0040.00420.16
8.3.10.0080.00021.91
8.3.00.0080.00020.77
8.2.180.0070.01418.42
8.2.170.0090.00622.96
8.2.160.0130.00022.23
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00022.10
8.2.120.0080.00026.35
8.2.110.0100.00022.37
8.2.100.0080.00418.03
8.2.90.0040.00419.23
8.2.80.0000.00817.97
8.2.70.0060.00317.75
8.2.60.0030.00517.92
8.2.50.0040.00418.10
8.2.40.0040.00422.46
8.2.30.0030.00521.04
8.2.20.0000.00718.17
8.2.10.0000.00718.10
8.2.00.0040.00418.17
8.1.280.0060.01225.92
8.1.270.0030.00623.79
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00623.96
8.1.230.0070.00422.07
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0090.00017.48
8.1.190.0080.00017.23
8.1.180.0000.00818.10
8.1.170.0030.00518.35
8.1.160.0040.00419.11
8.1.150.0040.00418.88
8.1.140.0040.00419.57
8.1.130.0000.00718.80
8.1.120.0100.00017.52
8.1.110.0040.00417.52
8.1.100.0030.00617.59
8.1.90.0000.00717.56
8.1.80.0070.00017.46
8.1.70.0000.00717.51
8.1.60.0050.00317.79
8.1.50.0000.00717.62
8.1.40.0000.00817.59
8.1.30.0050.00317.75
8.1.20.0030.00517.86
8.1.10.0030.00517.71
8.1.00.0000.00717.61
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0050.00318.48
8.0.270.0080.00017.26
8.0.260.0000.00717.00
8.0.250.0030.00317.14
8.0.240.0040.00416.95
8.0.230.0000.00717.19
8.0.220.0000.00716.96
8.0.210.0000.00716.95
8.0.200.0030.00317.11
8.0.190.0050.00517.16
8.0.180.0070.00316.98
8.0.170.0040.00417.04
8.0.160.0000.00817.04
8.0.150.0060.00316.91
8.0.140.0000.00816.86
8.0.130.0030.00513.43
8.0.120.0030.00517.09
8.0.110.0040.00417.04
8.0.100.0000.00816.88
8.0.90.0000.00716.90
8.0.80.0030.01216.97
8.0.70.0060.00317.08
8.0.60.0050.00216.90
8.0.50.0000.00717.11
8.0.30.0110.00517.50
8.0.20.0070.01217.43
8.0.10.0020.00517.22
8.0.00.0110.00716.95
7.4.330.0000.00515.55
7.4.320.0060.00016.75
7.4.300.0040.00416.73
7.4.290.0080.00016.81
7.4.280.0000.00716.69
7.4.270.0040.00416.80
7.4.260.0040.00216.66
7.4.250.0030.00316.67
7.4.240.0030.00516.74
7.4.230.0030.00316.95
7.4.220.0070.01116.73
7.4.210.0090.00616.77
7.4.200.0040.00416.59
7.4.160.0090.01016.76
7.4.150.0120.00617.40
7.4.140.0110.00817.86
7.4.130.0160.00916.67
7.4.120.0100.01116.76
7.4.110.0110.00616.79
7.4.100.0030.01316.54
7.4.90.0030.01416.59
7.4.80.0090.00919.39
7.4.70.0080.00916.65
7.4.60.0070.01016.59
7.4.50.0080.00416.70
7.4.40.0030.01316.80
7.4.30.0060.01116.77
7.4.00.0080.01115.10
7.3.330.0030.00313.38
7.3.320.0000.00613.52
7.3.310.0040.00416.59
7.3.300.0000.00716.45
7.3.290.0070.00016.45
7.3.280.0090.00716.53
7.3.270.0100.00717.40
7.3.260.0120.00716.54
7.3.250.0100.01116.56
7.3.240.0040.01416.50
7.3.230.0030.01516.74
7.3.210.0130.00916.71
7.3.200.0110.01116.88
7.3.190.0000.01816.75
7.3.180.0060.01516.69
7.3.170.0060.00916.42
7.3.160.0030.01216.47
7.3.120.0070.01015.17
7.3.110.0080.00914.87
7.3.100.0000.01714.90
7.3.90.0090.00414.95
7.3.80.0050.00915.26
7.3.70.0070.00515.01
7.3.60.0030.01114.93
7.3.50.0050.00815.08
7.3.40.0020.01314.94
7.3.30.0000.01215.12
7.3.20.0020.01116.94
7.3.10.0050.00916.82
7.3.00.0120.00416.61
7.2.330.0120.00916.70
7.2.320.0080.01216.90
7.2.310.0070.01016.84
7.2.300.0000.01816.81
7.2.290.0040.01216.78
7.2.250.0070.01315.38
7.2.240.0060.01015.11
7.2.230.0070.00915.14
7.2.220.0030.00615.19
7.2.210.0080.00515.35
7.2.200.0050.00815.20
7.2.190.0060.00715.07
7.2.180.0100.00315.19
7.2.170.0090.00715.35
7.2.130.0070.00716.97
7.2.120.0130.00417.13
7.2.110.0070.01116.87
7.2.100.0100.01017.04
7.2.90.0150.00416.72
7.2.80.0100.00716.89
7.2.70.0050.00816.91
7.2.60.0490.00616.15
7.2.50.0120.00617.04
7.2.40.0180.00617.13
7.2.30.0070.00717.05
7.2.20.0060.00917.07
7.2.10.0040.00817.15
7.2.00.0070.00618.40
7.1.330.0030.01015.99
7.1.320.0050.00615.77
7.1.310.0020.00916.02
7.1.300.0020.01416.02
7.1.290.0060.00715.98
7.1.280.0110.00215.98
7.1.270.0050.00615.89
7.1.260.0060.00615.77
7.1.250.0030.01616.09
7.1.240.0100.01016.13
7.1.230.0160.00316.11
7.1.220.0060.01015.83
7.1.210.0140.00315.80
7.1.200.0080.00716.00
7.1.190.0060.01216.03
7.1.180.0080.00816.11
7.1.170.0050.01115.97
7.1.160.0130.00716.10
7.1.150.0070.01015.80
7.1.140.0080.00815.79
7.1.130.0100.00615.93
7.1.120.0100.00716.02
7.1.110.0100.00316.06
7.1.100.0070.00617.31
7.1.90.0110.00415.96
7.1.80.0120.00315.96
7.1.70.0050.00516.65
7.1.60.0060.00816.69
7.1.50.0090.00816.55
7.1.40.0070.00916.28
7.1.30.0070.00816.54
7.1.20.0060.00916.36
7.1.10.0030.00916.30
7.1.00.0070.00616.32
7.0.330.0070.00715.72
7.0.320.0090.00615.60
7.0.310.0100.00715.39
7.0.300.0110.00715.70
7.0.290.0170.00015.42
7.0.280.0130.00315.54
7.0.270.0100.00615.65
7.0.260.0110.00715.54
7.0.250.0090.00615.78
7.0.240.0070.01015.54
7.0.230.0060.00915.73
7.0.220.0130.00315.82
7.0.210.0030.01015.58
7.0.200.0070.00316.30
7.0.190.0060.00516.34
7.0.180.0050.00915.96
7.0.170.0090.00515.94
7.0.160.0040.00916.00
7.0.150.0020.01116.04
7.0.140.0040.01015.90
7.0.130.0030.00716.29
7.0.120.0090.00416.27
7.0.110.0070.00716.17
7.0.100.0090.00316.17
7.0.90.0030.00916.18
7.0.80.0050.00816.07
7.0.70.0070.00516.02
7.0.60.0040.00815.92
7.0.50.0090.00316.10
7.0.40.0020.01114.64
7.0.30.0020.00714.61
7.0.20.0020.00714.61
7.0.10.0060.00614.53
7.0.00.0090.00214.57
5.6.380.0040.00714.56
5.6.370.0040.00814.18
5.6.360.0140.00314.39
5.6.350.0060.00614.43
5.6.340.0070.00714.64
5.6.330.0090.00514.25
5.6.320.0080.00314.57
5.6.310.0130.00614.39
5.6.300.0080.02117.67
5.6.290.0100.02717.58
5.6.280.0120.02317.57
5.6.270.0060.02517.86
5.6.260.0070.02117.60
5.6.250.0030.02417.61
5.6.240.0050.02817.54
5.6.230.0070.02117.56
5.6.220.0030.02717.52
5.6.210.0030.02717.71
5.6.200.0020.02917.54
5.6.190.0020.02917.57
5.6.180.0030.03617.58
5.6.170.0050.02617.64
5.6.160.0060.02717.73
5.6.150.0050.02417.60
5.6.140.0080.02317.55
5.6.130.0030.02617.70
5.6.120.0080.02317.69
5.6.110.0030.02717.64
5.6.100.0140.02217.56
5.6.90.0020.02617.53
5.6.80.0050.02417.25
5.6.70.0080.02117.18
5.6.60.0030.03017.24
5.6.50.0040.02517.41
5.6.40.0080.02117.37
5.6.30.0060.02517.41
5.6.20.0110.01917.21
5.6.10.0110.02017.35
5.6.00.0130.01917.21
5.5.380.0070.02014.45
5.5.370.0010.02814.34
5.5.360.0030.02514.42
5.5.350.0050.02314.36
5.5.340.0050.02414.55
5.5.330.0010.03514.72
5.5.320.0000.02614.65
5.5.310.0040.02114.51
5.5.300.0030.02414.68
5.5.290.0030.02214.46
5.5.280.0040.02314.63
5.5.270.0090.02014.44
5.5.260.0050.02214.51
5.5.250.0020.02814.45
5.5.240.0050.02214.34
5.5.230.0080.02114.40
5.5.220.0060.02014.19
5.5.210.0060.02314.31
5.5.200.0080.02014.29
5.5.190.0200.01614.25
5.5.180.0060.01914.13
5.5.170.0030.00711.08
5.5.160.0020.02514.41
5.5.150.0090.02614.24
5.5.140.0080.02314.27
5.5.130.0050.02214.33
5.5.120.0100.02014.29
5.5.110.0090.02114.28
5.5.100.0090.01914.21
5.5.90.0030.02513.98
5.5.80.0050.02314.29
5.5.70.0040.02414.11
5.5.60.0050.02314.04
5.5.50.0090.02014.11
5.5.40.0060.02214.24
5.5.30.0060.02314.29
5.5.20.0050.02614.34
5.5.10.0030.04414.20
5.5.00.0070.02014.23
5.4.450.0070.02015.44
5.4.440.0070.02015.08
5.4.430.0070.02015.39
5.4.420.0050.02415.49
5.4.410.0070.02515.13
5.4.400.0060.02115.32
5.4.390.0100.02015.09
5.4.380.0090.02115.04
5.4.370.0090.01915.17
5.4.360.0050.02515.06
5.4.350.0030.02614.97
5.4.340.0010.02614.93
5.4.330.0040.00911.04
5.4.320.0050.02215.14
5.4.310.0090.02715.23
5.4.300.0080.02215.08
5.4.290.0050.02915.19
5.4.280.0070.02615.06
5.4.270.0040.02515.06
5.4.260.0090.02015.30
5.4.250.0100.01815.12
5.4.240.0070.02815.04
5.4.230.0080.02015.24
5.4.220.0040.02715.16
5.4.210.0090.01815.04
5.4.200.0070.02014.95
5.4.190.0050.02315.04
5.4.180.0100.02115.12
5.4.170.0070.02315.19
5.4.160.0100.01615.10
5.4.150.0070.02315.26
5.4.140.0040.02513.69
5.4.130.0090.01913.98
5.4.120.0080.01813.88
5.4.110.0090.01713.94
5.4.100.0070.01914.01
5.4.90.0070.01813.83
5.4.80.0060.02213.62
5.4.70.0090.02113.73
5.4.60.0070.01913.78
5.4.50.0020.02413.68
5.4.40.0030.02013.70
5.4.30.0050.02213.88
5.4.20.0060.02013.89
5.4.10.0040.02214.00
5.4.00.0050.02313.57
5.3.290.0080.01813.16
5.3.280.0060.02013.04
5.3.270.0070.02013.03
5.3.260.0050.02113.00
5.3.250.0030.02313.17
5.3.240.0090.02113.03
5.3.230.0050.02213.09
5.3.220.0040.02213.07
5.3.210.0080.01812.97
5.3.200.0120.01413.04
5.3.190.0080.02113.11
5.3.180.0060.01912.96
5.3.170.0050.02113.14
5.3.160.0060.02413.13
5.3.150.0040.02712.99
5.3.140.0070.01912.98
5.3.130.0020.02613.08
5.3.120.0110.01912.99
5.3.110.0050.02313.08
5.3.100.0130.02013.13
5.3.90.0080.01913.17
5.3.80.0040.02213.08
5.3.70.0100.01613.00
5.3.60.0100.02213.08
5.3.50.0050.02113.02
5.3.40.0070.02113.02
5.3.30.0040.02313.08
5.3.20.0040.02013.08
5.3.10.0020.02412.97
5.3.00.0050.02113.00
5.2.170.0040.01712.74
5.2.160.0080.02712.74
5.2.150.0050.01812.74
5.2.140.0100.01512.74
5.2.130.0060.01712.74
5.2.120.0050.01712.74
5.2.110.0050.01512.74
5.2.100.0070.01512.74
5.2.90.0050.01412.74
5.2.80.0030.02012.74
5.2.70.0050.01612.74
5.2.60.0030.01812.74
5.2.50.0040.01912.74
5.2.40.0020.01812.74
5.2.30.0070.01412.74
5.2.20.0030.01712.74
5.2.10.0030.01912.74
5.2.00.0020.02312.74
5.1.60.0020.01512.74
5.1.50.0020.01912.74
5.1.40.0060.01112.74
5.1.30.0050.01612.74
5.1.20.0070.01212.74
5.1.10.0030.01812.74
5.1.00.0000.02312.74
5.0.50.0050.01112.74
5.0.40.0040.01112.74
5.0.30.0030.01812.74
5.0.20.0020.01212.74
5.0.10.0050.01112.74
5.0.00.0030.01812.74
4.4.90.0020.01012.74
4.4.80.0020.00812.74
4.4.70.0020.01012.74
4.4.60.0030.00812.74
4.4.50.0050.00712.74
4.4.40.0010.01812.74
4.4.30.0020.01512.74
4.4.20.0020.01112.74
4.4.10.0030.00912.74
4.4.00.0040.01312.74
4.3.110.0020.01312.74
4.3.100.0040.00812.74
4.3.90.0030.00912.74
4.3.80.0030.01612.74
4.3.70.0020.01312.74
4.3.60.0020.01212.74
4.3.50.0000.01212.74
4.3.40.0030.01612.74
4.3.30.0030.00912.74
4.3.20.0000.01412.74
4.3.10.0010.01112.74
4.3.00.0040.00912.74

preferences:
55.78 ms | 401 KiB | 5 Q