3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function get_self() { return new self(); } public function get_static() { return new static(); } } class B extends A {} class C { public function static_get_a_self() { return A::get_self(); } public function static_get_a_static() { return A::get_static(); } public function var_get_a_self() { $a = new A(); return $a->get_self(); } public function var_get_a_static() { $a = new A(); return $a->get_static(); } public function static_get_b_self() { return B::get_self(); } public function static_get_b_static() { return B::get_static(); } public function var_get_b_self() { $b = new B(); return $b->get_self(); } public function var_get_b_static() { $b = new B(); return $b->get_static(); } } $a = new A(); $b = new B(); $c = new C(); echo "Static calls: \n"; echo "B::get_self() ============= " . get_class(B::get_self()) . " | expected A \n"; echo "B::get_static() =========== " . get_class(B::get_static()) . " | expected B \n"; echo "A::get_static() =========== " . get_class(A::get_static()) . " | expected A \n"; echo "\n"; echo "Object Calls on A: \n"; echo '$a->get_self() ============ ' . get_class($a->get_self()) . " | expected A \n"; echo '$a->get_static() ========== ' . get_class($a->get_static()) . " | expected A \n"; echo "\n"; echo "Object Calls on B: \n"; echo '$b->get_self() ============ ' . get_class($b->get_self()) . " | expected A \n"; echo '$b->get_static() ========== ' . get_class($b->get_static()) . " | expected B \n"; echo "\n"; echo "C Object Calls on A: \n"; echo "Internally against A::{call}\n"; echo '$c->static_get_a_self() === ' . get_class($c->static_get_a_self()) . " | expected A \n"; echo '$c->static_get_a_static() = ' . get_class($c->static_get_a_static()) . " | expected A < Whoa! \n"; echo "Internally against \$a = new A();\n"; echo '$c->var_get_a_self() ====== ' . get_class($c->var_get_a_self()) . " | expected A \n"; echo '$c->var_get_a_static() ==== ' . get_class($c->var_get_a_static()) . " | expected A \n"; echo "\n"; echo "C Object Calls on B: \n"; echo "Internally against B::{call}\n"; echo '$c->static_get_b_self() === ' . get_class($c->static_get_b_self()) . " | expected A \n"; echo '$c->static_get_b_static() = ' . get_class($c->static_get_b_static()) . " | expected B < Whoa! \n"; echo "Internally against \$b = new B();\n"; echo '$c->var_get_b_self() ====== ' . get_class($c->var_get_b_self()) . " | expected A \n"; echo '$c->var_get_b_static() ==== ' . get_class($c->var_get_b_static()) . " | expected B \n"; ?>

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.0140.00316.88
8.3.60.0040.01118.05
8.3.50.0070.01221.27
8.3.40.0140.00018.83
8.3.30.0030.01020.20
8.3.20.0080.00518.83
8.3.10.0030.00621.13
8.3.00.0070.00023.61
8.2.180.0110.00717.00
8.2.170.0070.00722.96
8.2.160.0100.00320.24
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0070.00019.89
8.2.110.0040.00422.25
8.2.100.0080.00417.97
8.2.90.0000.00819.11
8.2.80.0040.00419.34
8.2.70.0060.00317.50
8.2.60.0080.00018.04
8.2.50.0060.00618.07
8.2.40.0000.00920.01
8.2.30.0040.00419.36
8.2.20.0050.00317.59
8.2.10.0040.00417.79
8.2.00.0000.00817.64
8.1.280.0110.00725.92
8.1.270.0050.00323.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00722.45
8.1.230.0090.00320.94
8.1.220.0080.00018.77
8.1.210.0070.00418.77
8.1.200.0030.00717.47
8.1.190.0040.00417.65
8.1.180.0060.00318.10
8.1.170.0050.00318.47
8.1.160.0050.00318.92
8.1.150.0000.00818.64
8.1.140.0000.00817.46
8.1.130.0040.00417.88
8.1.120.0000.00717.54
8.1.110.0070.00017.44
8.1.100.0000.00717.47
8.1.90.0040.00417.48
8.1.80.0070.00017.46
8.1.70.0030.00317.34
8.1.60.0030.00617.64
8.1.50.0000.00717.54
8.1.40.0080.00017.58
8.1.30.0060.00317.73
8.1.20.0040.00417.71
8.1.10.0050.00317.56
8.1.00.0050.00317.60
8.0.300.0000.01020.15
8.0.290.0040.00417.29
8.0.280.0070.00018.41
8.0.270.0000.00717.32
8.0.260.0030.00318.48
8.0.250.0040.00416.92
8.0.240.0050.00317.02
8.0.230.0070.00016.89
8.0.220.0050.00216.96
8.0.210.0000.00816.95
8.0.200.0000.00616.89
8.0.190.0040.00416.96
8.0.180.0070.00016.95
8.0.170.0050.00316.84
8.0.160.0000.00716.78
8.0.150.0030.00316.90
8.0.140.0110.00016.93
8.0.130.0050.00013.37
8.0.120.0050.00316.91
8.0.110.0070.00016.82
8.0.100.0080.00016.77
8.0.90.0040.00416.78
8.0.80.0060.00916.82
8.0.70.0040.00416.99
8.0.60.0050.00316.91
8.0.50.0000.00716.81
8.0.30.0060.01217.20
8.0.20.0060.01217.40
8.0.10.0000.00716.94
8.0.00.0100.01016.59
7.4.330.0000.00515.01
7.4.320.0000.00816.59
7.4.300.0040.00416.63
7.4.290.0040.00416.57
7.4.280.0030.00316.46
7.4.270.0000.00816.65
7.4.260.0060.00013.44
7.4.250.0040.00416.48
7.4.240.0000.00716.66
7.4.230.0030.00316.49
7.4.220.0160.01216.67
7.4.210.0140.00016.50
7.4.200.0000.00716.31
7.4.190.0040.00416.75
7.4.160.0160.00816.34
7.4.150.0070.01017.40
7.4.140.0130.00517.86
7.4.130.0120.00616.60
7.4.120.0090.00916.70
7.4.110.0100.00716.55
7.4.100.0080.00916.42
7.4.90.0150.00716.51
7.4.80.0100.01419.39
7.4.70.0110.00716.52
7.4.60.0080.00816.53
7.4.50.0030.00616.44
7.4.40.0060.00922.77
7.4.30.0110.00716.39
7.4.10.0090.00614.82
7.4.00.0060.01014.85
7.3.330.0030.00313.27
7.3.320.0030.00313.22
7.3.310.0000.00716.31
7.3.300.0000.00716.37
7.3.290.0090.00616.32
7.3.280.0070.01016.38
7.3.270.0110.00717.40
7.3.260.0150.00418.24
7.3.250.0120.00716.44
7.3.240.0030.01316.46
7.3.230.0100.00716.48
7.3.210.0080.01716.36
7.3.200.0080.01519.39
7.3.190.0110.01116.29
7.3.180.0110.00616.46
7.3.170.0120.00916.35
7.3.160.0070.01416.54
7.3.130.0130.00314.57
7.3.120.0050.01014.80
7.3.110.0040.01514.91
7.3.100.0100.00314.74
7.3.90.0100.00714.98
7.3.80.0030.00714.96
7.3.70.0070.01014.57
7.3.60.0080.00414.61
7.3.50.0090.00914.57
7.3.40.0090.00614.86
7.3.30.0080.00414.66
7.3.20.0070.00716.50
7.3.10.0100.00216.65
7.3.00.0050.00716.52
7.2.330.0040.01516.44
7.2.320.0080.01316.71
7.2.310.0120.00916.63
7.2.300.0070.01016.55
7.2.290.0030.01416.48
7.2.260.0100.01014.67
7.2.250.0140.00714.96
7.2.240.0120.00614.70
7.2.230.0030.01415.23
7.2.220.0030.00714.76
7.2.210.0060.00614.98
7.2.200.0050.00515.11
7.2.190.0100.01014.91
7.2.180.0090.00914.96
7.2.170.0000.01815.12
7.2.160.0000.01415.08
7.2.150.0000.01216.79
7.2.140.0060.00916.99
7.2.130.0080.00216.78
7.2.120.0080.00916.79
7.2.110.0050.00816.96
7.2.100.0060.00816.85
7.2.90.0050.01017.01
7.2.80.0090.00716.95
7.2.70.0050.00716.98
7.2.60.0040.01117.02
7.2.50.0030.01216.89
7.2.40.0060.00716.96
7.2.30.0040.01116.95
7.2.20.0080.00516.97
7.2.10.0050.00916.91
7.2.00.0090.00817.80
7.1.330.0090.00315.58
7.1.320.0090.00615.64
7.1.310.0090.00315.66
7.1.300.0090.00615.72
7.1.290.0000.01215.77
7.1.280.0060.00315.66
7.1.270.0000.01415.65
7.1.260.0100.00715.53
7.1.250.0040.00715.65
7.1.240.0060.00615.77
7.1.230.0080.00815.59
7.1.220.0030.00615.75
7.1.210.0050.00915.69
7.1.200.0080.00615.72
7.1.190.0070.00715.68
7.1.180.0000.01915.43
7.1.170.0070.00415.65
7.1.160.0030.01015.68
7.1.150.0090.00915.46
7.1.140.0040.01115.42
7.1.130.0060.00615.77
7.1.120.0030.01015.73
7.1.110.0040.00715.75
7.1.100.0070.00616.68
7.1.90.0030.00915.74
7.1.80.0110.00315.75
7.1.70.0050.00416.38
7.1.60.0060.01317.41
7.1.50.0050.01116.38
7.1.40.0060.00615.49
7.1.30.0040.01115.52
7.1.20.0000.00915.67
7.1.10.0030.01015.55
7.1.00.0030.04118.86
7.0.330.0030.01215.45
7.0.320.0030.00615.31
7.0.310.0110.00415.27
7.0.300.0030.00915.36
7.0.290.0030.01015.36
7.0.280.0070.00715.36
7.0.270.0030.00915.39
7.0.260.0030.01415.34
7.0.250.0070.01115.33
7.0.240.0030.01315.39
7.0.230.0030.01015.36
7.0.220.0030.00915.27
7.0.210.0100.00315.30
7.0.200.0030.00615.99
7.0.190.0000.01015.50
7.0.180.0070.00715.07
7.0.170.0030.01015.19
7.0.160.0040.00815.16
7.0.150.0040.00815.15
7.0.140.0020.04118.79
7.0.130.0030.01014.95
7.0.120.0040.00715.55
7.0.110.0040.00715.41
7.0.100.0070.00715.26
7.0.90.0030.00615.39
7.0.80.0060.00615.15
7.0.70.0200.02517.64
7.0.60.0160.02717.68
7.0.50.0300.03917.85
7.0.40.0120.03816.48
7.0.30.0020.02916.69
7.0.20.0060.04616.75
7.0.10.0120.03716.72
7.0.00.0080.04216.62
5.6.400.0070.01013.99
5.6.390.0080.00814.30
5.6.380.0040.00814.59
5.6.370.0040.01114.16
5.6.360.0090.00614.01
5.6.350.0030.01014.07
5.6.340.0070.00814.19
5.6.330.0060.00914.21
5.6.320.0060.01313.96
5.6.310.0090.00014.36
5.6.300.0070.01014.58
5.6.290.0030.01013.95
5.6.280.0070.04117.84
5.6.270.0160.00014.23
5.6.260.0060.00914.35
5.6.250.0040.01114.32
5.6.240.0060.00614.52
5.6.230.0060.00314.38
5.6.220.0070.02317.44
5.6.210.0030.02717.44
5.6.200.0030.04717.62
5.6.190.0110.02017.71
5.6.180.0080.04517.69
5.6.170.0090.04217.73
5.6.160.0100.04317.62
5.6.150.0100.04017.57
5.6.140.0030.04117.64
5.6.130.0100.04617.79
5.6.120.0100.04517.79
5.6.110.0050.03517.61
5.6.100.0090.03517.58
5.6.90.0080.04517.59
5.6.80.0020.04817.35
5.6.70.0030.03117.23
5.6.60.0050.05017.37
5.6.50.0080.03617.34
5.6.40.0070.03217.36
5.6.30.0080.03217.38
5.6.20.0100.02117.40
5.6.10.0000.03517.38
5.6.00.0090.03917.17
5.5.380.0030.01214.02
5.5.370.0070.01013.98
5.5.360.0050.02617.34
5.5.350.0060.02117.32
5.5.340.0050.03017.53
5.5.330.0030.02817.41
5.5.320.0070.04517.45
5.5.310.0130.02517.73
5.5.300.0040.04617.58
5.5.290.0060.04517.63
5.5.280.0050.02717.48
5.5.270.0100.02817.67
5.5.260.0090.04717.67
5.5.250.0060.04617.41
5.5.240.0090.03917.17
5.5.230.0080.03417.28
5.5.220.0180.03517.26
5.5.210.0100.03517.29
5.5.200.0070.04517.21
5.5.190.0080.04417.03
5.5.180.0080.04717.16
5.5.170.0090.00614.36
5.5.160.0050.04817.23
5.5.150.0030.03817.28
5.5.140.0050.03717.20
5.5.130.0050.02517.33
5.5.120.0020.03517.21
5.5.110.0070.04417.05
5.5.100.0100.04117.27
5.5.90.0060.02617.17
5.5.80.0050.03417.06
5.5.70.0080.04016.95
5.5.60.0110.04117.09
5.5.50.0130.04217.18
5.5.40.0080.03017.10
5.5.30.0030.02816.96
5.5.20.0070.02317.17
5.5.10.0020.04217.29
5.5.00.0040.02517.04
5.4.450.0050.04915.35
5.4.440.0070.02515.26
5.4.430.0050.02815.37
5.4.420.0050.04215.17
5.4.410.0090.03915.17
5.4.400.0080.03514.99
5.4.390.0050.02414.94
5.4.380.0050.02815.06
5.4.370.0070.04015.16
5.4.360.0030.04215.15
5.4.350.0120.02214.82
5.4.340.0050.03814.94
5.4.330.0060.00611.10
5.4.320.0020.02815.13
5.4.310.0080.04214.94
5.4.300.0050.04415.04
5.4.290.0030.02515.13
5.4.280.0050.02215.10
5.4.270.0070.04114.92
5.4.260.0070.02414.98
5.4.250.0040.02615.11
5.4.240.0000.04714.80
5.4.230.0070.03815.04
5.4.220.0060.03915.01
5.4.210.0120.03915.00
5.4.200.0060.02515.04
5.4.190.0020.04315.06
5.4.180.0000.02514.88
5.4.170.0050.04614.93
5.4.160.0100.02515.03
5.4.150.0070.03915.07
5.4.140.0090.03613.88
5.4.130.0020.03213.65
5.4.120.0030.04213.66
5.4.110.0020.04513.72
5.4.100.0080.02313.85
5.4.90.0080.03813.78
5.4.80.0090.03513.82
5.4.70.0060.03913.80
5.4.60.0040.03413.63
5.4.50.0100.03513.79
5.4.40.0130.02513.85
5.4.30.0030.04013.76
5.4.20.0070.03913.58
5.4.10.0000.03013.62
5.4.00.0000.02713.48
5.3.290.0050.03713.34
5.3.280.0040.04413.28
5.3.270.0090.03013.22
5.3.260.0100.03613.19
5.3.250.0110.04213.23
5.3.240.0070.04413.19
5.3.230.0070.03813.24
5.3.220.0020.02813.19
5.3.210.0110.03813.19
5.3.200.0030.04413.25
5.3.190.0060.04113.10
5.3.180.0070.03713.30
5.3.170.0030.04213.26
5.3.160.0050.03113.30
5.3.150.0070.04013.21
5.3.140.0080.04013.26
5.3.130.0100.03713.13
5.3.120.0050.03913.13
5.3.110.0070.02713.10
5.3.100.0080.04113.24
5.3.90.0100.02313.13
5.3.80.0020.02513.20
5.3.70.0060.03313.07
5.3.60.0000.02313.23
5.3.50.0020.03913.26
5.3.40.0050.03413.27
5.3.30.0070.02813.22
5.3.20.0060.02913.19
5.3.10.0020.04013.13
5.3.00.0080.03813.09
5.2.170.0130.04715.85
5.2.160.0000.03315.85
5.2.150.0130.05015.85
5.2.140.0030.03015.85
5.2.130.0100.06015.85
5.2.120.0130.05015.85
5.2.110.0100.05715.85
5.2.100.0000.06015.85
5.2.90.0030.06315.85
5.2.80.0030.06315.85
5.2.70.0000.03715.85
5.2.60.0030.03015.85
5.2.50.0100.05315.85
5.2.40.0030.03315.85
5.2.30.0030.06315.85
5.2.20.0070.03715.85
5.2.10.0100.03015.85
5.2.00.0000.05715.85
5.1.60.0000.04715.85
5.1.50.0100.01715.85
5.1.40.0170.03715.85
5.1.30.0100.04015.85
5.1.20.0000.05015.85
5.1.10.0100.02715.85
5.1.00.0100.05315.85
5.0.50.0000.03715.85
5.0.40.0030.04315.85
5.0.30.0070.05015.85
5.0.20.0100.02315.85
5.0.10.0100.04015.85
5.0.00.0000.06715.85
4.4.90.0030.01715.85
4.4.80.0070.02315.85
4.4.70.0000.05315.85
4.4.60.0100.02715.85
4.4.50.0030.01315.85
4.4.40.0030.02715.85
4.4.30.0000.04015.85
4.4.20.0070.03315.85
4.4.10.0000.03715.85
4.4.00.0000.03315.85
4.3.110.0070.03315.85
4.3.100.0000.01715.85
4.3.90.0000.03315.85
4.3.80.0000.04315.85
4.3.70.0030.03715.85
4.3.60.0030.03315.85
4.3.50.0070.03315.85
4.3.40.0000.04715.85
4.3.30.0000.03715.85
4.3.20.0000.02715.85
4.3.10.0000.03715.85
4.3.00.0100.03015.85

preferences:
42.42 ms | 401 KiB | 5 Q