3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Script to check whether current() takes its parameter by reference or by value */ 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)); current($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.0060.00918.43
8.3.50.0120.00316.64
8.3.40.0100.00719.10
8.3.30.0090.00618.95
8.3.20.0000.00720.18
8.3.10.0080.00021.60
8.3.00.0040.00420.79
8.2.180.0090.00918.75
8.2.170.0070.00722.96
8.2.160.0070.00722.11
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00422.33
8.2.120.0050.00326.35
8.2.110.0060.00322.25
8.2.100.0130.00017.91
8.2.90.0030.00519.03
8.2.80.0050.00317.97
8.2.70.0000.00817.63
8.2.60.0040.00417.93
8.2.50.0000.00818.10
8.2.40.0080.00022.30
8.2.30.0000.00820.97
8.2.20.0040.00418.06
8.2.10.0000.00818.11
8.2.00.0000.00718.22
8.1.280.0110.00425.92
8.1.270.0070.00024.02
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.98
8.1.230.0040.00722.16
8.1.220.0060.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0030.00517.35
8.1.180.0050.00318.10
8.1.170.0050.00318.75
8.1.160.0070.00019.02
8.1.150.0060.00318.77
8.1.140.0000.00719.55
8.1.130.0070.00018.86
8.1.120.0100.00017.51
8.1.110.0080.00017.59
8.1.100.0060.00317.56
8.1.90.0030.00617.53
8.1.80.0030.00517.63
8.1.70.0070.00017.49
8.1.60.0040.00417.74
8.1.50.0090.00017.66
8.1.40.0030.00517.72
8.1.30.0050.00317.80
8.1.20.0060.00317.78
8.1.10.0090.00017.66
8.1.00.0040.00417.68
8.0.300.0000.00718.77
8.0.290.0060.00316.75
8.0.280.0000.00718.34
8.0.270.0000.00717.23
8.0.260.0030.00318.37
8.0.250.0070.00017.15
8.0.240.0030.00416.91
8.0.230.0040.00417.09
8.0.220.0030.00316.96
8.0.210.0000.00617.04
8.0.200.0030.00317.17
8.0.190.0000.00817.03
8.0.180.0080.00317.14
8.0.170.0000.00717.07
8.0.160.0030.00417.10
8.0.150.0000.00717.00
8.0.140.0000.00817.06
8.0.130.0050.00213.49
8.0.120.0050.00417.04
8.0.110.0040.00416.98
8.0.100.0040.00417.13
8.0.90.0040.00417.08
8.0.80.0090.00617.07
8.0.70.0020.00517.06
8.0.60.0040.00417.13
8.0.50.0080.00017.09
8.0.30.0110.00717.32
8.0.20.0100.01017.44
8.0.10.0040.00417.09
8.0.00.0130.00716.73
7.4.330.0000.00515.55
7.4.320.0030.00316.81
7.4.300.0040.00416.89
7.4.290.0070.00016.83
7.4.280.0080.00016.71
7.4.270.0040.00416.70
7.4.260.0030.00316.79
7.4.250.0000.00716.71
7.4.240.0070.00016.73
7.4.230.0030.00316.63
7.4.220.0130.00716.76
7.4.210.0070.00716.79
7.4.200.0030.00316.66
7.4.160.0120.00416.54
7.4.150.0040.01517.40
7.4.140.0080.01117.86
7.4.130.0070.01417.00
7.4.120.0080.01316.83
7.4.110.0120.00616.79
7.4.100.0200.00416.60
7.4.90.0130.00316.85
7.4.80.0120.00619.39
7.4.70.0140.00416.70
7.4.60.0060.00916.68
7.4.50.0070.00716.50
7.4.40.0080.00816.79
7.4.30.0170.00016.91
7.4.00.0070.00714.90
7.3.330.0000.00613.36
7.3.320.0050.00013.35
7.3.310.0000.00716.56
7.3.300.0070.00016.54
7.3.290.0000.00716.45
7.3.280.0060.01016.53
7.3.270.0160.00617.40
7.3.260.0120.00716.71
7.3.250.0130.00416.62
7.3.240.0070.01016.68
7.3.230.0080.00816.79
7.3.210.0030.01316.43
7.3.200.0040.01216.68
7.3.190.0130.00316.45
7.3.180.0160.00016.45
7.3.170.0100.00716.81
7.3.160.0090.00616.73
7.2.330.0060.01217.02
7.2.320.0090.00916.77
7.2.310.0070.01016.98
7.2.300.0100.01316.89
7.2.290.0160.00016.89
7.2.60.0090.00616.82
7.2.00.0070.01119.31
7.1.200.0000.01215.88
7.1.100.0040.00918.62
7.1.70.0000.00817.49
7.1.60.0430.01033.54
7.1.50.0430.02032.96
7.1.40.0400.01332.91
7.1.30.0570.00732.90
7.1.20.0430.02033.14
7.1.10.0230.01015.09
7.1.00.0200.01315.12
7.0.200.0470.01015.30
7.0.190.0570.00715.07
7.0.180.0300.01014.76
7.0.170.0370.01014.64
7.0.160.0470.00314.78
7.0.150.0330.00014.76
7.0.140.0300.00714.84
7.0.130.0230.01015.20
7.0.120.0270.01014.95
7.0.110.0300.00714.66
7.0.100.0270.00714.90
7.0.90.0270.00714.94
7.0.80.0330.01014.77
7.0.70.0230.01314.84
7.0.60.0270.00714.72
7.0.50.0300.00714.88
7.0.40.0330.00714.90
7.0.30.0270.00714.92
7.0.20.0200.01314.78
7.0.10.0270.01314.98
7.0.00.0230.01014.79
5.6.300.0130.05720.78
5.6.290.0170.05020.93
5.6.280.0130.05021.02
5.6.270.0130.05320.82
5.6.260.0030.06020.80
5.6.250.0170.05020.82
5.6.240.0130.05720.84
5.6.230.0100.07720.77
5.6.220.0130.05020.89
5.6.210.0070.06020.74
5.6.200.0070.06020.79
5.6.190.0030.07020.81
5.6.180.0100.05320.75
5.6.170.0070.05720.98
5.6.160.0070.05720.78
5.6.150.0070.06320.77
5.6.140.0000.06720.96
5.6.130.0070.05720.77
5.6.120.0070.06020.93
5.6.110.0130.05720.80
5.6.100.0170.04720.80
5.6.90.0070.05720.86
5.6.80.0030.05720.16
5.6.70.0070.05320.37
5.6.60.0030.06020.31
5.6.50.0100.05020.17
5.6.40.0070.05720.12
5.6.30.0070.05320.23
5.6.20.0070.05720.30
5.6.10.0070.05320.29
5.6.00.0130.05020.11
5.5.380.0100.05317.47
5.5.370.0100.05317.47
5.5.360.0070.05717.55
5.5.350.0100.05017.57
5.5.340.0170.04317.70
5.5.330.0070.05718.00
5.5.320.0070.07017.73
5.5.310.0130.05318.07
5.5.300.0070.06017.73
5.5.290.0170.05018.03
5.5.280.0030.06318.13
5.5.270.0070.06718.03
5.5.260.0200.04318.03
5.5.250.0170.06017.58
5.5.240.0070.05317.32
5.5.230.0070.05317.39
5.5.220.0130.04717.43
5.5.210.0070.07017.34
5.5.200.0170.04317.16
5.5.190.0070.05717.30
5.5.180.0100.05017.16
5.5.160.0000.06017.15
5.5.150.0030.05717.08
5.5.140.0070.05017.38
5.5.130.0030.05717.11
5.5.120.0030.05717.11
5.5.110.0100.05017.38
5.5.100.0030.06017.27
5.5.90.0070.05017.28
5.5.80.0170.04317.39
5.5.70.0030.06017.36
5.5.60.0100.05317.06
5.5.50.0070.05317.26
5.5.40.0100.04717.18
5.5.30.0100.05316.97
5.5.20.0070.05317.36
5.5.10.0100.07017.01
5.5.00.0100.05717.17
5.4.450.0100.06019.27
5.4.440.0130.05019.24
5.4.430.0100.05019.43
5.4.420.0030.05719.24
5.4.410.0130.04719.35
5.4.400.0030.05319.13
5.4.390.0100.05319.07
5.4.380.0100.07718.92
5.4.370.0100.05019.02
5.4.360.0070.05319.05
5.4.350.0070.05719.00
5.4.340.0130.05319.05
5.4.320.0130.05318.80
5.4.310.0030.05319.07
5.4.300.0100.05018.93
5.4.290.0000.06019.02
5.4.280.0000.06019.00
5.4.270.0130.05019.02
5.4.260.0070.05718.90
5.4.250.0030.05319.05
5.4.240.0030.05718.98
5.4.230.0030.06718.99
5.4.220.0030.06019.01
5.4.210.0130.04718.95
5.4.200.0030.05719.05
5.4.190.0000.06019.00
5.4.180.0030.06319.23
5.4.170.0100.05018.97
5.4.160.0100.04719.12
5.4.150.0100.05018.88
5.4.140.0170.04316.56
5.4.130.0070.05016.45
5.4.120.0000.08016.48
5.4.110.0130.06016.63
5.4.100.0030.05316.66
5.4.90.0070.04716.74
5.4.80.0100.05016.59
5.4.70.0070.05016.71
5.4.60.0100.06316.40
5.4.50.0070.05016.59
5.4.40.0070.05016.62
5.4.30.0070.05016.55
5.4.20.0170.03716.63
5.4.10.0100.04716.61
5.4.00.0130.04316.15
5.3.290.0130.04714.87
5.3.280.0170.04014.61
5.3.270.0030.05714.80
5.3.260.0070.05014.62
5.3.250.0100.04714.84
5.3.240.0130.04314.92
5.3.230.0070.05314.80
5.3.220.0200.06014.63
5.3.210.0170.05314.86
5.3.200.0130.04314.86
5.3.190.0130.05014.75
5.3.180.0100.05014.86
5.3.170.0130.04314.89
5.3.160.0070.05314.63
5.3.150.0100.05014.75
5.3.140.0100.05314.75
5.3.130.0130.04714.73
5.3.120.0070.05314.86
5.3.110.0100.05014.87
5.3.100.0070.05314.27
5.3.90.0070.05014.08
5.3.80.0130.04314.24
5.3.70.0130.04314.02
5.3.60.0070.05314.30
5.3.50.0130.04314.25
5.3.40.0100.04714.14
5.3.30.0000.05314.14
5.3.20.0170.04013.91
5.3.10.0070.05013.71
5.3.00.0100.04713.86
5.2.170.0000.05311.42
5.2.160.0070.04011.45
5.2.150.0100.03711.38
5.2.140.0070.04011.34
5.2.130.0070.05311.34
5.2.120.0070.04011.40
5.2.110.0030.04311.16
5.2.100.0070.04011.11
5.2.90.0000.04710.98
5.2.80.0030.06311.40
5.2.70.0030.06311.13
5.2.60.0030.06311.07
5.2.50.0100.04311.09
5.2.40.0070.04010.99
5.2.30.0100.04311.03
5.2.20.0030.04711.17
5.2.10.0030.05710.93
5.2.00.0070.05711.00
5.1.60.0100.0439.89
5.1.50.0030.04710.33
5.1.40.0130.0409.93
5.1.30.0070.05010.39
5.1.20.0070.04010.67
5.1.10.0070.05010.14
5.1.00.0070.04310.38
5.0.50.0070.0278.61
5.0.40.0070.0278.74
5.0.30.0030.0408.52
5.0.20.0070.0308.30
5.0.10.0030.0308.34
5.0.00.0100.0378.44
4.4.90.0000.0335.98
4.4.80.0030.0206.03
4.4.70.0000.0235.99
4.4.60.0070.0276.06
4.4.50.0030.0305.99
4.4.40.0070.0405.98
4.4.30.0030.0275.95
4.4.20.0000.0376.00
4.4.10.0000.0236.04
4.4.00.0030.0336.02
4.3.110.0000.0235.91
4.3.100.0000.0235.89
4.3.90.0070.0175.88
4.3.80.0030.0436.01
4.3.70.0030.0235.90
4.3.60.0000.0235.90
4.3.50.0070.0175.88
4.3.40.0000.0335.84
4.3.30.0030.0205.76
4.3.20.0030.0205.76
4.3.10.0070.0175.76
4.3.00.0070.0175.76

preferences:
40.86 ms | 401 KiB | 5 Q