3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private static $instance = null; private $my_value = 'Foo'; public function __construct() { } public static function my_function() { if ( !isset(self::$instance) ) self::$instance = new self; if( isset( $this ) ) { $target = $this; // I know its an invalid declaration } else { $target = self::$instance; // I know its an invalid declaration } return $target->my_value; // Invalid statement } } $my_object = new MyClass(); echo $my_object->my_function()."\n"; echo MyClass::my_function();

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.70.0130.00618.43
8.3.60.0140.00718.56
8.3.50.0180.00321.21
8.3.40.0140.00018.79
8.3.30.0140.00020.17
8.3.20.0040.00420.21
8.3.10.0070.00022.09
8.3.00.0050.00322.40
8.2.190.0150.00316.63
8.2.180.0090.00916.63
8.2.170.0110.00422.96
8.2.160.0040.01120.52
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00626.16
8.2.120.0070.00019.77
8.2.110.0100.00021.06
8.2.100.0090.00317.91
8.2.90.0000.00917.75
8.2.80.0050.00317.97
8.2.70.0000.00817.93
8.2.60.0000.00917.93
8.2.50.0040.00418.10
8.2.40.0080.00020.30
8.2.30.0080.00018.03
8.2.20.0000.00817.53
8.2.10.0050.00217.59
8.2.00.0000.00817.75
8.1.280.0120.00325.92
8.1.270.0040.00424.66
8.1.260.0070.00026.35
8.1.250.0060.00328.09
8.1.240.0070.00722.14
8.1.230.0070.00422.75
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0040.00417.36
8.1.180.0080.00018.10
8.1.170.0050.00318.59
8.1.160.0070.00022.14
8.1.150.0070.00018.55
8.1.140.0040.00417.46
8.1.130.0060.00317.93
8.1.120.0050.00217.50
8.1.110.0000.00817.34
8.1.100.0030.00417.36
8.1.90.0040.00417.50
8.1.80.0060.00317.37
8.1.70.0070.00017.39
8.1.60.0040.00417.59
8.1.50.0030.00517.51
8.1.40.0000.00817.42
8.1.30.0070.00017.62
8.1.20.0000.00917.66
8.1.10.0040.00417.61
8.1.00.0040.00417.57
8.0.300.0030.00519.98
8.0.290.0070.00016.75
8.0.280.0030.00318.41
8.0.270.0000.00717.25
8.0.260.0060.00016.84
8.0.250.0000.00716.85
8.0.240.0030.00616.93
8.0.230.0070.00016.97
8.0.220.0000.00716.92
8.0.210.0000.00716.89
8.0.200.0030.00316.89
8.0.190.0000.00716.84
8.0.180.0030.00316.81
8.0.170.0050.00316.91
8.0.160.0000.00716.91
8.0.150.0000.00716.79
8.0.140.0040.00416.78
8.0.130.0030.00313.39
8.0.120.0000.00716.79
8.0.110.0040.00416.82
8.0.100.0040.00416.76
8.0.90.0000.00716.78
8.0.80.0060.00916.90
8.0.70.0000.00816.88
8.0.60.0080.00017.01
8.0.50.0000.00716.92
8.0.30.0140.00917.17
8.0.20.0080.01017.40
8.0.10.0050.00317.08
8.0.00.0120.00616.67
7.4.330.0000.00515.00
7.4.320.0000.00716.48
7.4.300.0000.00616.49
7.4.290.0030.00516.65
7.4.280.0030.00316.50
7.4.270.0030.00316.65
7.4.260.0030.00316.59
7.4.250.0030.00516.46
7.4.240.0040.00416.59
7.4.230.0020.00516.32
7.4.220.0080.00816.51
7.4.210.0050.01116.61
7.4.200.0080.00016.43
7.4.190.0040.00416.76
7.4.160.0090.00616.70
7.4.150.0100.00717.40
7.4.140.0110.01017.86
7.4.130.0120.00616.58
7.4.120.0080.00916.48
7.4.110.0170.00016.41
7.4.100.0070.01416.59
7.4.90.0160.01016.45
7.4.80.0100.00719.39
7.4.70.0070.01016.30
7.4.60.0090.00916.46
7.4.50.0000.00816.54
7.4.40.0050.00822.77
7.4.30.0100.00616.65
7.4.00.0060.00914.97
7.3.330.0000.00513.30
7.3.320.0000.00513.22
7.3.310.0080.00016.32
7.3.300.0030.00316.30
7.3.290.0030.01016.29
7.3.280.0090.00616.27
7.3.270.0040.01317.40
7.3.260.0190.00016.53
7.3.250.0110.01016.37
7.3.240.0090.01316.26
7.3.230.0030.01316.42
7.3.210.0090.00616.40
7.3.200.0030.01219.39
7.3.190.0140.00316.53
7.3.180.0080.00816.19
7.3.170.0030.01316.36
7.3.160.0070.01016.43
7.3.120.0130.00015.03
7.2.330.0090.01216.82
7.2.320.0090.00916.79
7.2.310.0110.00716.77
7.2.300.0200.00016.77
7.2.290.0070.01416.78
7.1.100.0030.00918.07
7.1.70.0000.01017.13
7.1.60.0030.01319.21
7.1.50.0070.01716.74
7.1.00.0030.07022.40
7.0.200.0270.01314.82
7.0.140.0030.07322.04
7.0.100.0300.03719.95
7.0.90.0030.04719.93
7.0.80.0170.03719.93
7.0.70.0000.06019.91
7.0.60.0030.07719.96
7.0.50.0070.06720.25
7.0.40.0030.03720.03
7.0.30.0000.04320.04
7.0.20.0030.05720.08
7.0.10.0100.03320.02
7.0.00.0100.08320.07
5.6.280.0030.07320.77
5.6.250.0030.07720.47
5.6.240.0000.04020.64
5.6.230.0070.06720.64
5.6.220.0030.04320.74
5.6.210.0100.04020.75
5.6.200.0070.08321.12
5.6.190.0030.04720.91
5.6.180.0200.06321.08
5.6.170.0030.04321.02
5.6.160.0100.06721.11
5.6.150.0130.08021.17
5.6.140.0100.07321.17
5.6.130.0070.08321.07
5.6.120.0130.03721.08
5.6.110.0100.05721.07
5.6.100.0030.04321.12
5.6.90.0000.04321.16
5.6.80.0200.06720.30
5.6.70.0130.03020.34
5.6.60.0030.04020.47
5.6.50.0130.02720.35
5.6.40.0100.03020.53
5.6.30.0000.03720.38
5.6.20.0170.05720.42
5.6.10.0170.03320.40
5.6.00.0100.07020.29
5.5.380.0000.04020.39
5.5.370.0030.03720.37
5.5.360.0130.04020.41
5.5.350.0070.03320.41
5.5.340.0000.06020.89
5.5.330.0100.05020.86
5.5.320.0030.04320.89
5.5.310.0030.04320.75
5.5.300.0130.07320.92
5.5.290.0100.08020.83
5.5.280.0030.08720.89
5.5.270.0070.03720.91
5.5.260.0130.07720.86
5.5.250.0100.05720.69
5.5.240.0070.08020.21
5.5.230.0070.04320.21
5.5.220.0000.06320.11
5.5.210.0100.04020.15
5.5.200.0170.07720.13
5.5.190.0100.06320.21
5.5.180.0100.04020.25
5.5.160.0030.08020.12
5.5.150.0030.08020.17
5.5.140.0070.03720.11
5.5.130.0070.04320.20
5.5.120.0100.06720.13
5.5.110.0030.08020.23
5.5.100.0100.03319.98
5.5.90.0100.07020.07
5.5.80.0070.06720.11
5.5.70.0130.06720.10
5.5.60.0100.02720.15
5.5.50.0030.05320.05
5.5.40.0070.03020.11
5.5.30.0100.04719.95
5.5.20.0070.03320.09
5.5.10.0100.06319.97
5.5.00.0130.03020.04
5.4.450.0100.08019.35
5.4.440.0100.07719.47
5.4.430.0100.06019.16
5.4.420.0030.05019.41
5.4.410.0070.03719.41
5.4.400.0170.06319.12
5.4.390.0030.07019.03
5.4.380.0030.07719.22
5.4.370.0000.06718.95
5.4.360.0000.05319.23
5.4.350.0070.08019.12
5.4.340.0030.07319.09
5.4.320.0000.03719.03
5.4.310.0130.07319.12
5.4.300.0030.06319.12
5.4.290.0030.05018.96
5.4.280.0130.05718.88
5.4.270.0030.07318.90
5.4.260.0070.07319.20
5.4.250.0170.06318.89
5.4.240.0100.07319.16
5.4.230.0070.03019.17
5.4.220.0130.04019.15
5.4.210.0100.08019.11
5.4.200.0130.07019.13
5.4.190.0070.03719.15
5.4.180.0100.02719.14
5.4.170.0070.06319.22
5.4.160.0030.05019.18
5.4.150.0100.03319.02
5.4.140.0130.06316.20
5.4.130.0030.07716.40
5.4.120.0100.06716.44
5.4.110.0030.04016.27
5.4.100.0100.03316.46
5.4.90.0100.03716.35
5.4.80.0130.06316.47
5.4.70.0170.05016.46
5.4.60.0030.05316.36
5.4.50.0000.04716.32
5.4.40.0100.06016.53
5.4.30.0000.04016.36
5.4.20.0100.07016.25
5.4.10.0000.04716.36
5.4.00.0070.05315.64
5.3.290.0000.03714.62
5.3.280.0070.07714.70
5.3.270.0070.07714.69
5.3.260.0100.07714.75
5.3.250.0130.05014.60
5.3.240.0000.04314.60
5.3.230.0000.04314.70
5.3.220.0030.05314.54
5.3.210.0030.08014.64
5.3.200.0000.04314.68
5.3.190.0130.06714.56
5.3.180.0030.04314.68
5.3.170.0000.04314.56
5.3.160.0000.07014.54
5.3.150.0130.05014.63
5.3.140.0100.03314.63
5.3.130.0170.03314.62
5.3.120.0130.03714.66
5.3.110.0100.03314.52
5.3.100.0030.04014.05
5.3.90.0100.07314.09
5.3.80.0170.06314.14
5.3.70.0100.04714.16
5.3.60.0030.04314.03
5.3.50.0000.05014.01
5.3.40.0100.07313.97
5.3.30.0070.06014.04
5.3.20.0070.03713.72
5.3.10.0030.06313.56
5.3.00.0030.07013.57
5.2.170.0030.06712.02
5.2.160.0000.06312.02
5.2.150.0130.05312.02
5.2.140.0070.05312.02
5.2.130.0000.05312.02
5.2.120.0070.05312.02
5.2.110.0070.05712.02
5.2.100.0000.03312.02
5.2.90.0030.04312.02
5.2.80.0070.05312.02
5.2.70.0070.06312.02
5.2.60.0070.05712.02
5.2.50.0100.05712.02
5.2.40.0130.04312.02
5.2.30.0000.03312.02
5.2.20.0070.02712.02
5.2.10.0030.05012.02
5.2.00.0100.06012.02
5.1.60.0070.05312.02
5.1.50.0030.03712.02
5.1.40.0030.04712.02
5.1.30.0100.04012.02
5.1.20.0030.06012.02
5.1.10.0070.05012.02
5.1.00.0000.05712.02
5.0.50.0070.02312.02
5.0.40.0070.03312.02
5.0.30.0000.05312.02
5.0.20.0000.05012.02
5.0.10.0030.02712.02
5.0.00.0030.06712.02
4.4.90.0030.03312.02
4.4.80.0000.01712.02
4.4.70.0000.02012.02
4.4.60.0070.02312.02
4.4.50.0030.02312.02
4.4.40.0070.04312.02
4.4.30.0100.02012.02
4.4.20.0070.03312.02
4.4.10.0000.03012.02
4.4.00.0000.03312.02
4.3.110.0000.03712.02
4.3.100.0000.03712.02
4.3.90.0030.03312.02
4.3.80.0070.02312.02
4.3.70.0000.02012.02
4.3.60.0070.01312.02
4.3.50.0000.01712.02
4.3.40.0070.02012.02
4.3.30.0000.01712.02
4.3.20.0070.03712.02
4.3.10.0070.01012.02
4.3.00.0030.03712.02

preferences:
49.14 ms | 401 KiB | 5 Q