3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-type: text/plain"); class Foo { /** * An indentifier * @var string */ private $name; /** * A reference to another Foo object * @var Foo */ private $link; public function __construct($name) { $this->name = $name; } public function setLink(Foo $link){ $this->link = $link; } public function __destruct() { echo 'Destroying: ', $this->name, PHP_EOL; unset( $this->link ); } } // create two Foo objects: $foo = new Foo('Foo 1'); $bar = new Foo('Foo 2'); // make them point to each other $foo->setLink($bar); $bar->setLink($foo); // destroy the global references to them unset( $bar ); $foo = null; $bar = null; // we now have no way to access Foo 1 or Foo 2, so they OUGHT to be __destruct()ed // but they are not, so we get a memory leak as they are still in memory. // // Uncomment the next line to see the difference when explicitly calling the GC: //gc_collect_cycles(); // // see also: http://www.php.net/manual/en/features.gc.php // // create two more Foo objects, but DO NOT set their internal Foo references // so nothing except the vars $foo and $bar point to them: $foo = new Foo('Foo 3'); $bar = new Foo('Foo 4'); // destroy the global references to them $foo = null; $bar = null; // we now have no way to access Foo 3 or Foo 4 and as there are no more references // to them anywhere, their __destruct() methods are automatically called here, // BEFORE the next line is executed: echo 'End of script', PHP_EOL; ?>

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.0090.00616.63
8.3.50.0110.00917.49
8.3.40.0120.00318.79
8.3.30.0070.00718.66
8.3.20.0030.00618.92
8.3.10.0040.00418.95
8.3.00.0060.00319.38
8.2.180.0130.00316.75
8.2.170.0080.00822.96
8.2.160.0070.00720.44
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0050.00226.16
8.2.120.0000.00820.79
8.2.110.0030.00720.96
8.2.100.0080.00317.72
8.2.90.0030.00619.47
8.2.80.0040.00419.39
8.2.70.0000.00917.38
8.2.60.0000.00817.89
8.2.50.0080.00018.07
8.2.40.0030.00518.16
8.2.30.0030.00618.01
8.2.20.0030.00617.57
8.2.10.0050.00317.59
8.2.00.0000.00817.71
8.1.270.0080.00024.66
8.1.260.0050.00326.35
8.1.250.0030.00628.09
8.1.240.0030.00523.92
8.1.230.0080.00417.48
8.1.220.0040.00417.74
8.1.210.0040.00718.84
8.1.200.0030.00617.38
8.1.190.0090.00017.50
8.1.180.0030.00618.10
8.1.170.0050.00318.97
8.1.160.0040.00418.78
8.1.150.0000.00818.61
8.1.140.0070.00017.49
8.1.130.0000.00717.86
8.1.120.0040.00417.45
8.1.110.0040.00417.41
8.1.100.0000.00817.41
8.1.90.0050.00217.46
8.1.80.0000.00717.45
8.1.70.0000.00717.32
8.1.60.0040.00417.55
8.1.50.0030.00617.56
8.1.40.0050.00317.54
8.1.30.0080.00017.66
8.1.20.0040.00417.63
8.1.10.0000.00717.66
8.1.00.0080.00017.53
8.0.300.0050.00320.20
8.0.290.0040.00416.75
8.0.280.0070.00018.54
8.0.270.0030.00317.29
8.0.260.0030.00316.86
8.0.250.0000.00816.97
8.0.240.0040.00416.96
8.0.230.0000.00816.97
8.0.220.0050.00216.85
8.0.210.0030.00316.80
8.0.200.0030.00616.99
8.0.190.0040.00416.89
8.0.180.0030.00617.02
8.0.170.0040.00416.92
8.0.160.0040.00416.92
8.0.150.0030.00616.88
8.0.140.0030.00616.89
8.0.130.0000.00613.41
8.0.120.0000.00716.90
8.0.110.0050.00216.84
8.0.100.0050.00516.95
8.0.90.0040.00416.93
8.0.80.0150.00316.88
8.0.70.0040.00416.87
8.0.60.0030.00516.93
8.0.50.0040.00416.82
8.0.30.0110.00916.95
8.0.20.0030.01416.86
8.0.10.0050.00217.10
8.0.00.0130.00916.88
7.4.330.0030.00312.99
7.4.320.0060.00016.45
7.4.300.0000.00716.65
7.4.290.0070.00316.54
7.4.280.0050.00316.60
7.4.270.0070.00016.55
7.4.260.0000.00513.34
7.4.250.0080.00016.51
7.4.240.0000.00716.48
7.4.230.0070.00016.48
7.4.220.0150.00316.73
7.4.210.0110.00516.62
7.4.200.0040.00416.73
7.4.190.0040.00416.51
7.4.160.0060.00916.56
7.4.150.0110.00616.51
7.4.140.0160.00216.48
7.4.130.0130.00616.48
7.4.120.0140.00516.63
7.4.110.0110.00716.60
7.4.100.0140.00316.51
7.4.90.0120.00616.63
7.4.80.0090.00919.39
7.4.70.0100.00716.62
7.4.60.0060.00916.48
7.4.50.0100.00216.58
7.4.40.0040.00816.57
7.4.30.0140.00316.71
7.4.00.0070.01014.68
7.3.330.0070.00013.26
7.3.320.0030.00313.13
7.3.310.0000.00716.35
7.3.300.0070.00016.25
7.3.290.0100.01016.22
7.3.280.0110.00616.24
7.3.270.0090.00916.50
7.3.260.0070.01516.49
7.3.250.0090.00816.25
7.3.240.0000.01716.26
7.3.230.0090.01216.54
7.3.210.0040.01316.47
7.3.200.0150.00316.24
7.3.190.0070.01016.59
7.3.180.0090.00716.41
7.3.170.0080.00816.47
7.3.160.0090.00916.52
7.3.120.0060.01014.87
7.2.330.0060.01216.77
7.2.320.0130.01016.37
7.2.310.0130.01616.46
7.2.300.0070.01016.70
7.2.290.0110.00516.48
7.2.60.0070.00317.02
7.2.50.0190.00016.82
7.1.200.0000.01315.48
7.1.100.0200.00418.08
7.1.70.0000.01017.15
7.1.60.0130.00319.40
7.1.50.0060.01316.95
7.1.00.0170.06322.36
7.0.200.0130.00614.66
7.0.140.0000.07722.01
7.0.120.0000.07722.05
7.0.60.0030.08720.03
7.0.50.0100.06717.86
7.0.40.0100.07717.69
7.0.30.0100.07317.79
7.0.20.0100.07317.79
7.0.10.0030.08317.84
7.0.00.0070.05717.68
5.6.210.0000.08720.48
5.6.200.0070.08318.20
5.6.190.0070.04018.16
5.6.180.0030.06018.19
5.6.170.0030.05318.22
5.6.160.0030.05018.17
5.6.150.0100.08018.18
5.6.140.0030.08718.17
5.6.130.0070.08718.27
5.6.120.0130.08018.18
5.6.110.0130.08018.22
5.6.100.0170.04318.27
5.6.90.0000.05718.20
5.6.80.0070.04017.54
5.6.70.0070.03717.50
5.6.60.0030.04717.55
5.6.50.0070.08017.56
5.6.40.0030.07317.59
5.6.30.0200.06317.63
5.6.20.0070.04717.54
5.6.10.0100.07317.50
5.6.00.0100.03317.61
5.5.350.0000.03320.43
5.5.340.0030.08717.98
5.5.330.0030.05317.99
5.5.320.0100.06317.99
5.5.310.0070.07718.03
5.5.300.0100.06017.94
5.5.290.0030.07318.01
5.5.280.0100.07717.96
5.5.270.0070.07318.02
5.5.260.0000.05017.97
5.5.250.0030.07317.80
5.5.240.0100.03317.36
5.5.230.0070.06317.33
5.5.220.0100.03317.33
5.5.210.0130.07017.46
5.5.200.0130.07317.33
5.5.190.0200.05717.29
5.5.180.0070.06717.30
5.5.160.0030.04017.34
5.5.150.0170.07317.30
5.5.140.0100.07717.29
5.5.130.0030.08317.27
5.5.120.0200.05017.34
5.5.110.0070.07317.30
5.5.100.0030.05717.34
5.5.90.0030.08017.28
5.5.80.0100.07317.32
5.5.70.0100.06017.18
5.5.60.0130.03017.19
5.5.50.0000.04017.22
5.5.40.0130.02717.21
5.5.30.0000.04017.28
5.5.20.0070.03317.27
5.5.10.0030.03717.31
5.5.00.0030.04017.20
5.4.450.0030.08019.35
5.4.440.0030.07319.35
5.4.430.0070.05019.43
5.4.420.0100.07719.42
5.4.410.0070.06319.19
5.4.400.0070.04319.05
5.4.390.0030.06319.01
5.4.380.0070.07718.89
5.4.370.0070.08018.89
5.4.360.0130.07019.13
5.4.350.0100.07019.09
5.4.340.0130.06318.98
5.4.320.0100.04319.08
5.4.310.0030.04718.98
5.4.300.0070.07019.05
5.4.290.0070.06019.02
5.4.280.0070.06718.98
5.4.270.0070.08018.98
5.4.260.0170.06719.02
5.4.250.0130.07019.09
5.4.240.0130.06019.25
5.4.230.0070.07019.09
5.4.220.0030.04019.26
5.4.210.0000.04018.98
5.4.200.0000.04019.05
5.4.190.0030.03719.06
5.4.180.0000.04018.98
5.4.170.0070.03319.12
5.4.160.0030.03718.87
5.4.150.0030.04019.09
5.4.140.0000.08016.31
5.4.130.0030.06016.46
5.4.120.0070.07016.33
5.4.110.0000.03716.40
5.4.100.0000.03716.55
5.4.90.0030.04016.38
5.4.80.0000.03716.54
5.4.70.0000.03716.46
5.4.60.0030.03316.21
5.4.50.0000.03716.43
5.4.40.0100.02716.41
5.4.30.0000.03716.45
5.4.20.0000.04016.45
5.4.10.0030.03316.41
5.4.00.0030.03315.90
5.3.290.0030.08014.69
5.3.280.0170.06314.62
5.3.270.0030.03714.60
5.3.260.0030.03714.64
5.3.250.0030.03714.57
5.3.240.0100.06714.56
5.3.230.0000.04014.64
5.3.220.0000.05014.60
5.3.210.0030.04014.67
5.3.200.0000.04014.57
5.3.190.0030.05714.63
5.3.180.0100.03014.58
5.3.170.0030.03714.61
5.3.160.0030.03714.57
5.3.150.0000.03714.59
5.3.140.0130.03314.40
5.3.130.0000.04014.66
5.3.120.0100.03014.58
5.3.110.0000.04014.61
5.3.100.0070.03014.07
5.3.90.0030.03313.89
5.3.80.0000.03714.01
5.3.70.0000.03713.87
5.3.60.0000.03714.01
5.3.50.0030.03313.98
5.3.40.0000.04013.94
5.3.30.0000.03713.96
5.3.20.0030.04013.68
5.3.10.0070.03713.55
5.3.00.0100.02713.64
5.2.170.0000.03011.20
5.2.160.0000.03011.12
5.2.150.0000.03711.17
5.2.140.0000.03011.11
5.2.130.0030.02711.18
5.2.120.0030.02711.15
5.2.110.0100.02011.04
5.2.100.0000.03311.20
5.2.90.0000.03011.14
5.2.80.0000.03010.98
5.2.70.0000.04711.09
5.2.60.0070.06011.09
5.2.50.0030.06711.08
5.2.40.0030.05710.89
5.2.30.0000.04011.02
5.2.20.0000.06310.99
5.2.10.0030.06010.89
5.2.00.0070.06010.77
5.1.60.0030.05010.67
5.1.50.0030.04310.67
5.1.40.0030.03310.67
5.1.30.0070.05710.67
5.1.20.0070.04710.67
5.1.10.0000.03010.67
5.1.00.0030.06010.67
5.0.50.0030.02010.67
5.0.40.0000.04710.67
5.0.30.0070.06010.67
5.0.20.0000.03310.67
5.0.10.0000.03310.67
5.0.00.0200.02710.67
4.4.90.0000.01710.67
4.4.80.0030.02710.67
4.4.70.0000.02710.67
4.4.60.0000.03710.67
4.4.50.0000.03010.67
4.4.40.0070.05010.67
4.4.30.0030.02710.67
4.4.20.0000.02310.67
4.4.10.0030.01710.67
4.4.00.0100.04710.67
4.3.110.0070.03310.67
4.3.100.0000.03710.67
4.3.90.0070.02010.67
4.3.80.0030.03710.67
4.3.70.0000.04010.67
4.3.60.0000.02010.67
4.3.50.0100.02710.67
4.3.40.0000.04010.67
4.3.30.0070.03310.67
4.3.20.0030.03710.67
4.3.10.0070.03010.67
4.3.00.0000.03310.67

preferences:
59.49 ms | 400 KiB | 5 Q