3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getGrandParentClass($object, $level = NULL) { $gp = $object = get_class($object); $isNull = is_null($level); $j = 0; while(get_parent_class($gp) && ($isNull || $level > $j)) { $gp = get_parent_class($gp); $j++; if(!get_parent_class($gp) && !$isNull && $level > $j) return false; } return $gp == $object ? false : $gp; } class A {} class B extends A {} class C extends B {} class D extends C {} var_dump(getGrandParentClass(new A())); // false var_dump(getGrandParentClass(new D(), 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.60.0120.00616.75
8.3.50.0080.01222.11
8.3.40.0000.01518.97
8.3.30.0070.00719.09
8.3.20.0000.00720.29
8.3.10.0080.00023.70
8.3.00.0070.00020.58
8.2.180.0160.00618.16
8.2.170.0060.00918.99
8.2.160.0070.00722.96
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0060.01326.16
8.2.120.0080.00022.13
8.2.110.0060.00320.40
8.2.100.0080.00317.84
8.2.90.0040.00419.09
8.2.80.0040.00418.04
8.2.70.0000.00917.38
8.2.60.0060.00318.03
8.2.50.0000.00818.07
8.2.40.0030.00518.22
8.2.30.0040.00818.09
8.2.20.0050.00317.57
8.2.10.0020.00517.80
8.2.00.0040.00417.67
8.1.280.0070.00725.92
8.1.270.0040.00423.91
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00923.91
8.1.230.0040.00718.97
8.1.220.0040.00417.80
8.1.210.0030.00618.77
8.1.200.0040.00717.23
8.1.190.0060.00317.41
8.1.180.0000.00818.10
8.1.170.0030.00618.64
8.1.160.0030.00522.03
8.1.150.0000.00718.72
8.1.140.0070.00017.47
8.1.130.0070.00017.88
8.1.120.0080.00017.39
8.1.110.0050.00217.51
8.1.100.0000.00717.47
8.1.90.0000.00817.50
8.1.80.0040.00417.30
8.1.70.0040.00417.36
8.1.60.0030.00617.53
8.1.50.0080.00017.45
8.1.40.0040.00417.55
8.1.30.0030.00617.60
8.1.20.0030.00617.71
8.1.10.0040.00417.59
8.1.00.0000.00817.52
8.0.300.0080.00018.77
8.0.290.0000.00717.05
8.0.280.0070.00018.38
8.0.270.0000.00817.20
8.0.260.0040.00416.94
8.0.250.0000.00817.06
8.0.240.0070.00316.99
8.0.230.0030.00617.00
8.0.220.0030.00316.86
8.0.210.0000.00716.87
8.0.200.0050.00317.07
8.0.190.0000.00816.92
8.0.180.0040.00416.99
8.0.170.0040.00416.99
8.0.160.0020.00517.03
8.0.150.0000.00716.89
8.0.140.0040.00416.94
8.0.130.0060.00013.43
8.0.120.0040.00416.91
8.0.110.0040.00416.94
8.0.100.0000.00816.95
8.0.90.0000.00716.98
8.0.80.0090.01016.98
8.0.70.0040.00416.96
8.0.60.0000.00716.99
8.0.50.0000.00717.04
8.0.30.0180.00517.26
8.0.20.0110.00617.40
8.0.10.0040.00417.12
8.0.00.0100.00816.86
7.4.330.0000.00515.00
7.4.320.0030.00316.41
7.4.300.0030.00316.52
7.4.290.0000.00916.52
7.4.280.0000.00716.63
7.4.270.0000.00716.41
7.4.260.0000.00716.57
7.4.250.0000.00716.57
7.4.240.0000.00716.60
7.4.230.0040.00416.72
7.4.220.0200.00616.63
7.4.210.0080.01016.53
7.4.200.0070.00016.71
7.4.190.0000.00716.76
7.4.160.0140.00716.41
7.4.150.0130.00317.40
7.4.140.0100.01017.86
7.4.130.0060.01216.52
7.4.120.0080.00916.56
7.4.110.0110.00516.49
7.4.100.0070.01116.42
7.4.90.0100.01416.57
7.4.80.0090.00916.48
7.4.70.0100.00716.60
7.4.60.0120.00616.50
7.4.50.0000.00616.54
7.4.40.0030.01022.77
7.4.30.0060.00916.65
7.4.10.0090.00916.16
7.4.00.0040.01115.45
7.3.330.0000.00513.23
7.3.320.0000.00613.27
7.3.310.0030.00316.20
7.3.300.0030.00316.48
7.3.290.0060.01016.40
7.3.280.0130.00616.43
7.3.270.0110.00817.40
7.3.260.0000.01716.41
7.3.250.0060.01316.52
7.3.240.0090.00616.52
7.3.230.0000.01616.54
7.3.210.0100.01016.45
7.3.200.0160.00419.39
7.3.190.0030.01516.68
7.3.180.0060.01016.56
7.3.170.0030.01316.40
7.3.160.0080.00816.49
7.3.130.0090.01316.33
7.3.120.0040.01315.25
7.3.110.0060.00915.70
7.3.100.0100.00715.67
7.3.90.0100.00915.63
7.3.80.0060.01015.54
7.3.70.0100.00715.70
7.3.60.0050.01115.55
7.3.50.0080.00615.54
7.3.40.0090.00615.57
7.3.30.0030.01015.64
7.3.20.0020.01317.52
7.3.10.0040.01117.58
7.3.00.0090.00717.56
7.2.330.0090.00916.88
7.2.320.0070.01016.54
7.2.310.0140.00716.65
7.2.300.0160.00016.83
7.2.290.0060.01116.55
7.2.260.0100.00616.72
7.2.250.0100.01115.69
7.2.240.0110.00515.96
7.2.230.0060.00816.00
7.2.220.0080.00615.83
7.2.210.0060.00915.91
7.2.200.0040.01315.78
7.2.190.0090.00515.60
7.2.180.0100.00515.68
7.2.170.0070.00915.68
7.2.160.0080.00615.81
7.2.150.0040.01017.57
7.2.140.0080.00617.72
7.2.130.0050.01017.74
7.2.120.0030.00817.59
7.2.110.0070.00717.66
7.2.100.0110.00517.75
7.2.90.0030.00717.71
7.2.80.0030.01517.76
7.2.70.0070.00917.73
7.2.60.0080.00717.74
7.2.50.0050.01217.78
7.2.40.0070.00817.65
7.2.30.0070.00617.81
7.2.20.0090.00917.63
7.2.10.0120.00017.62
7.2.00.0070.00718.32
7.1.330.0050.01216.62
7.1.320.0060.00916.60
7.1.310.0080.00316.76
7.1.300.0070.00716.64
7.1.290.0100.00516.71
7.1.280.0060.00816.60
7.1.270.0050.00816.60
7.1.260.0090.00716.66
7.1.250.0050.01016.57
7.1.240.0040.01116.43
7.1.230.0070.00716.58
7.1.220.0060.00416.49
7.1.210.0070.00716.53
7.1.200.0060.00816.57
7.1.190.0050.01116.56
7.1.180.0030.01016.54
7.1.170.0100.00516.51
7.1.160.0050.00716.63
7.1.150.0080.00516.48
7.1.140.0050.00816.63
7.1.130.0090.00516.57
7.1.120.0080.00516.65
7.1.110.0070.00716.65
7.1.100.0050.00917.21
7.1.90.0040.00816.59
7.1.80.0060.00616.57
7.1.70.0050.00816.68
7.1.60.0070.00817.47
7.1.50.0070.01016.74
7.1.40.0060.00816.56
7.1.30.0070.00716.53
7.1.20.0100.00316.38
7.1.10.0060.00816.61
7.1.00.0050.03218.55
7.0.330.0020.01216.15
7.0.320.0050.01016.30
7.0.310.0030.00816.17
7.0.300.0050.00816.17
7.0.290.0060.00816.07
7.0.280.0060.00716.09
7.0.270.0050.00916.15
7.0.260.0070.00816.14
7.0.250.0080.00816.14
7.0.240.0100.00516.19
7.0.230.0050.01016.20
7.0.220.0080.00716.11
7.0.210.0100.00316.35
7.0.200.0080.00716.29
7.0.190.0040.00916.30
7.0.180.0040.01116.39
7.0.170.0040.00916.25
7.0.160.0020.01116.22
7.0.150.0080.00816.24
7.0.140.0050.02918.16
7.0.130.0070.00816.12
7.0.120.0060.00616.37
7.0.110.0070.00816.20
7.0.100.0070.02217.55
7.0.90.0070.02017.52
7.0.80.0110.03317.37
7.0.70.0140.02817.35
7.0.60.0130.02117.51
7.0.50.0100.02117.57
7.0.40.0090.02416.22
7.0.30.0110.02116.21
7.0.20.0070.03216.07
7.0.10.0100.02716.18
7.0.00.0070.03516.16
5.6.400.0100.00615.13
5.6.390.0030.00615.04
5.6.380.0050.00815.13
5.6.370.0070.01215.13
5.6.360.0070.00515.30
5.6.350.0050.01015.00
5.6.340.0030.00714.93
5.6.330.0060.00815.04
5.6.320.0080.00715.30
5.6.310.0050.00814.93
5.6.300.0030.01115.18
5.6.290.0070.00415.10
5.6.280.0050.02916.98
5.6.270.0080.00815.05
5.6.260.0090.00415.25
5.6.250.0060.01816.98
5.6.240.0050.01616.93
5.6.230.0070.03116.82
5.6.220.0070.03216.92
5.6.210.0060.02717.01
5.6.200.0050.03517.05
5.6.190.0070.03317.13
5.6.180.0060.02617.04
5.6.170.0070.03617.01
5.6.160.0070.03117.04
5.6.150.0090.02017.03
5.6.140.0080.02917.06
5.6.130.0080.03316.97
5.6.120.0080.03117.01
5.6.110.0020.02817.15
5.6.100.0090.02617.00
5.6.90.0040.02416.98
5.6.80.0070.02916.80
5.6.70.0040.03316.86
5.6.60.0040.02516.79
5.6.50.0110.02816.74
5.6.40.0090.02716.86
5.6.30.0040.02916.95
5.6.20.0130.02616.79
5.6.10.0040.03316.77
5.6.00.0070.02516.88
5.5.380.0050.02316.72
5.5.370.0030.02616.68
5.5.360.0100.01916.75
5.5.350.0090.03116.79
5.5.340.0080.03216.91
5.5.330.0090.03116.90
5.5.320.0030.03317.09
5.5.310.0120.03116.92
5.5.300.0100.02417.03
5.5.290.0050.02516.95
5.5.280.0080.02117.00
5.5.270.0060.03216.83
5.5.260.0090.02916.92
5.5.250.0080.02516.80
5.5.240.0090.02916.57
5.5.230.0060.03016.79
5.5.220.0080.02016.79
5.5.210.0100.02816.57
5.5.200.0060.02216.63
5.5.190.0070.02316.56
5.5.180.0070.01916.74
5.5.170.0000.01314.94
5.5.160.0040.02116.68
5.5.150.0080.02816.68
5.5.140.0060.02816.63
5.5.130.0090.02316.47
5.5.120.0060.03016.59
5.5.110.0050.02016.61
5.5.100.0090.02616.54
5.5.90.0090.02116.60
5.5.80.0090.02916.56
5.5.70.0080.03116.66
5.5.60.0130.01216.54
5.5.50.0110.02716.66
5.5.40.0060.02916.62
5.5.30.0050.02716.72
5.5.20.0090.03016.65
5.5.10.0050.03216.60
5.5.00.0080.03416.76
5.4.450.0050.03215.10
5.4.440.0060.03115.10
5.4.430.0040.01715.09
5.4.420.0060.02615.11
5.4.410.0060.01715.06
5.4.400.0040.02014.99
5.4.390.0030.03414.94
5.4.380.0020.02214.89
5.4.370.0070.02814.99
5.4.360.0090.02515.00
5.4.350.0040.02514.97
5.4.340.0040.02514.89
5.4.330.0030.00712.89
5.4.320.0040.02614.96
5.4.310.0080.02914.95
5.4.300.0020.02814.95
5.4.290.0080.02514.94
5.4.280.0040.02414.98
5.4.270.0070.02614.97
5.4.260.0050.01514.96
5.4.250.0050.01915.02
5.4.240.0030.02614.94
5.4.230.0040.03014.95
5.4.220.0060.03214.96
5.4.210.0060.02514.99
5.4.200.0050.03114.90
5.4.190.0010.02914.96
5.4.180.0030.03214.97
5.4.170.0110.02514.90
5.4.160.0040.02214.95
5.4.150.0050.02214.93
5.4.140.0040.02214.09
5.4.130.0060.02614.00
5.4.120.0060.02914.08
5.4.110.0030.02814.11
5.4.100.0090.02814.10
5.4.90.0060.02814.12
5.4.80.0080.02714.11
5.4.70.0050.02014.04
5.4.60.0030.02714.04
5.4.50.0040.02314.06
5.4.40.0060.02914.06
5.4.30.0080.02914.07
5.4.20.0060.01514.07
5.4.10.0080.02414.08
5.4.00.0070.02813.89
5.3.290.0080.02013.61
5.3.280.0060.02513.59
5.3.270.0080.01613.59
5.3.260.0070.02613.63
5.3.250.0090.02613.59
5.3.240.0080.02013.55
5.3.230.0050.02313.61
5.3.220.0060.01913.62
5.3.210.0110.02913.56
5.3.200.0050.02313.59
5.3.190.0030.02613.59
5.3.180.0090.02713.72
5.3.170.0090.02013.60
5.3.160.0080.01913.64
5.3.150.0070.03213.59
5.3.140.0100.01413.59
5.3.130.0060.02813.61
5.3.120.0050.03213.57
5.3.110.0060.02913.58
5.3.100.0040.03113.48
5.3.90.0050.02813.47
5.3.80.0040.02613.35
5.3.70.0090.01313.36
5.3.60.0060.03013.38
5.3.50.0060.02613.37
5.3.40.0030.03113.39
5.3.30.0050.03213.43
5.3.20.0070.02813.30
5.3.10.0050.02613.18
5.3.00.0050.03313.21
5.2.170.0030.06313.64
5.2.160.0070.06013.64
5.2.150.0030.06313.64
5.2.140.0070.06313.64
5.2.130.0130.05013.64
5.2.120.0000.06013.64
5.2.110.0030.06713.64
5.2.100.0030.06313.64
5.2.90.0200.03013.64
5.2.80.0030.06013.64
5.2.70.0070.06013.64
5.2.60.0030.05013.64
5.2.50.0000.06013.64
5.2.40.0030.06313.64
5.2.30.0030.06313.64
5.2.20.0030.06713.64
5.2.10.0030.04313.64
5.2.00.0070.03313.64
5.1.60.0070.02313.64
5.1.50.0030.03013.64
5.1.40.0030.05713.64
5.1.30.0030.05013.64
5.1.20.0070.04313.64
5.1.10.0030.02313.64
5.1.00.0030.03013.64
5.0.50.0030.04713.64
5.0.40.0030.04313.64
5.0.30.0000.06013.64
5.0.20.0000.03013.64
5.0.10.0030.04313.64
5.0.00.0000.06013.64
4.4.90.0030.02313.64
4.4.80.0000.03313.64
4.4.70.0070.03013.64
4.4.60.0000.02713.64
4.4.50.0070.03313.64
4.4.40.0070.05013.64
4.4.30.0030.03013.64
4.4.20.0000.03713.64
4.4.10.0070.03013.64
4.4.00.0000.05713.64
4.3.110.0030.03313.64
4.3.100.0000.03313.64
4.3.90.0070.03013.64
4.3.80.0000.04713.64
4.3.70.0030.03313.64
4.3.60.0000.03713.64
4.3.50.0000.03713.64
4.3.40.0000.05313.64
4.3.30.0070.02713.64
4.3.20.0030.03013.64
4.3.10.0000.03713.64
4.3.00.0070.01313.64

preferences:
47.82 ms | 401 KiB | 5 Q