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(), new StdClass));

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.0030.01216.88
8.3.50.0300.00516.68
8.3.40.0140.00318.89
8.3.30.0130.00718.83
8.3.20.0040.01118.86
8.3.10.0000.00818.77
8.3.00.0030.00519.51
8.2.180.0160.00616.63
8.2.170.0040.01122.96
8.2.160.0150.00021.20
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00421.00
8.2.110.0030.00720.35
8.2.100.0090.00317.84
8.2.90.0090.00019.08
8.2.80.0000.00719.20
8.2.70.0030.00617.63
8.2.60.0060.00317.93
8.2.50.0030.00618.07
8.2.40.0050.00518.22
8.2.30.0030.00617.94
8.2.20.0030.00617.55
8.2.10.0040.00417.83
8.2.00.0000.00917.70
8.1.280.0030.01125.92
8.1.270.0060.00324.66
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0130.00021.98
8.1.230.0000.01120.91
8.1.220.0050.00318.77
8.1.210.0040.00419.15
8.1.200.0060.00317.35
8.1.190.0070.00017.39
8.1.180.0040.00418.10
8.1.170.0050.00518.94
8.1.160.0040.00418.91
8.1.150.0060.00318.53
8.1.140.0000.00817.52
8.1.130.0030.00317.83
8.1.120.0100.00017.50
8.1.110.0070.00017.50
8.1.100.0030.00417.36
8.1.90.0040.00417.46
8.1.80.0030.00317.49
8.1.70.0030.00317.45
8.1.60.0040.00417.48
8.1.50.0000.00817.42
8.1.40.0040.00417.53
8.1.30.0040.00417.56
8.1.20.0040.00417.69
8.1.10.0000.00717.64
8.1.00.0000.00817.60
8.0.300.0050.00219.82
8.0.290.0000.00716.75
8.0.280.0030.00318.33
8.0.270.0030.00517.16
8.0.260.0040.00416.85
8.0.250.0040.00417.03
8.0.240.0000.00716.92
8.0.230.0000.00716.94
8.0.220.0020.00517.01
8.0.210.0070.00016.94
8.0.200.0030.00317.00
8.0.190.0000.00816.94
8.0.180.0030.00716.97
8.0.170.0040.00416.81
8.0.160.0070.00017.10
8.0.150.0000.00816.97
8.0.140.0000.00816.88
8.0.130.0030.00313.39
8.0.120.0050.00316.87
8.0.110.0000.00816.95
8.0.100.0040.00416.95
8.0.90.0030.00516.96
8.0.80.0070.00717.03
8.0.70.0040.00316.99
8.0.60.0000.00816.85
8.0.50.0040.00416.86
8.0.30.0070.01517.24
8.0.20.0120.00917.04
8.0.10.0000.00817.11
8.0.00.0080.01216.80
7.4.330.0000.00513.01
7.4.320.0070.00016.61
7.4.300.0020.00516.51
7.4.290.0000.00716.66
7.4.280.0080.00016.62
7.4.270.0040.00416.50
7.4.260.0000.00513.35
7.4.250.0040.00416.66
7.4.240.0020.00516.46
7.4.230.0030.00316.57
7.4.220.0030.01616.58
7.4.210.0100.00516.63
7.4.200.0000.00716.38
7.4.190.0000.00816.33
7.4.160.0060.01016.31
7.4.150.0120.00916.75
7.4.140.0110.00816.51
7.4.130.0120.00916.52
7.4.120.0110.01116.68
7.4.110.0030.01316.67
7.4.100.0100.00716.42
7.4.90.0120.01216.58
7.4.80.0060.01216.60
7.4.70.0000.01716.56
7.4.60.0070.01016.52
7.4.50.0090.00316.55
7.4.40.0090.00316.16
7.4.30.0120.00416.29
7.4.00.0070.00714.84
7.3.330.0060.00013.27
7.3.320.0000.00613.29
7.3.310.0030.00516.43
7.3.300.0030.00316.31
7.3.290.0130.00616.45
7.3.280.0100.00816.46
7.3.270.0060.01316.56
7.3.260.0180.00716.28
7.3.250.0100.00716.50
7.3.240.0070.01516.52
7.3.230.0120.00316.43
7.3.210.0080.01616.39
7.3.200.0090.00916.46
7.3.190.0130.01016.46
7.3.180.0130.00316.55
7.3.170.0090.01116.38
7.3.160.0130.00316.54
7.3.120.0070.01014.94
7.3.110.0070.00715.12
7.3.100.0000.01414.92
7.3.90.0070.01014.78
7.3.80.0070.01014.69
7.3.70.0070.00314.86
7.3.60.0130.00014.55
7.3.50.0000.01314.63
7.3.40.0000.01315.04
7.3.30.0080.00814.97
7.3.20.0060.00616.77
7.3.10.0130.00016.70
7.3.00.0000.01216.86
7.2.330.0140.00416.82
7.2.320.0070.01116.79
7.2.310.0130.01016.68
7.2.300.0110.00716.80
7.2.290.0090.00916.73
7.2.240.0030.00915.08
7.2.230.0090.00615.03
7.2.220.0040.00815.04
7.2.210.0120.00315.09
7.2.200.0070.01015.16
7.2.190.0040.01115.14
7.2.180.0090.00614.91
7.2.170.0070.01015.06
7.2.160.0080.00414.84
7.2.150.0070.00316.97
7.2.140.0040.01117.02
7.2.130.0140.00016.74
7.2.120.0030.01017.02
7.2.110.0000.01016.93
7.2.100.0070.00716.94
7.2.90.0060.00916.78
7.2.80.0040.00817.00
7.2.70.0070.01116.94
7.2.60.0030.00916.95
7.2.50.0040.01116.88
7.2.40.0040.01117.04
7.2.30.0040.01117.07
7.2.20.0070.00416.89
7.2.10.0100.00616.71
7.2.00.0050.00718.23
7.1.330.0000.01415.77
7.1.320.0000.01415.82
7.1.310.0070.00715.80
7.1.300.0040.00815.70
7.1.290.0060.00915.84
7.1.280.0030.01115.84
7.1.270.0080.00815.96
7.1.260.0030.00615.86
7.1.250.0030.00715.82
7.1.200.0090.00615.72
7.1.70.0030.00917.09
7.1.60.0030.02019.40
7.1.50.0130.01017.02
7.1.00.0070.06722.31
7.0.200.0100.01014.66
7.0.140.0030.07322.12
7.0.120.0100.06321.96
7.0.60.0030.06020.05
7.0.50.0030.08017.87
7.0.40.0100.05020.05
7.0.30.0470.06720.10
7.0.20.0370.08020.07
7.0.10.0230.05720.23
7.0.00.0070.08020.05
5.6.280.0030.07021.16
5.6.210.0100.06020.70
5.6.200.0030.04318.16
5.6.190.0100.08020.61
5.6.180.0400.07320.56
5.6.170.0200.04320.62
5.6.160.0130.05720.43
5.6.150.0070.08318.18
5.6.140.0170.07718.15
5.6.130.0030.05718.18
5.6.120.0100.03321.01
5.6.110.0070.07721.02
5.6.100.0200.07021.05
5.6.90.0170.06321.09
5.6.80.0030.04020.52
5.6.70.0230.07020.37
5.5.350.0130.04320.39
5.5.340.0070.08018.09
5.5.330.0170.07020.41
5.5.320.0270.07320.37
5.5.310.0200.03720.36
5.5.300.0130.08018.08
5.5.290.0030.04018.06
5.5.280.0100.08320.77
5.5.270.0070.04320.65
5.5.260.0170.08320.88
5.5.250.0100.07020.79
5.5.240.0070.03720.33
5.4.450.1430.03719.28
5.4.440.1570.04019.28
5.4.430.1430.03319.38
5.4.420.1700.03019.19
5.4.410.1570.03319.16
5.4.400.1430.04019.00
5.4.390.1600.04018.87
5.4.380.1630.02319.08
5.4.370.1570.03719.31
5.4.360.1730.04719.22
5.4.350.1900.03719.00
5.4.340.1970.04018.98
5.4.320.1830.04019.09
5.4.310.1630.03718.98
5.4.300.1600.03719.14
5.4.290.1630.03718.97
5.4.280.1570.04019.08
5.4.270.1870.04319.23
5.4.260.1730.03319.08
5.4.250.1970.04019.30
5.4.240.1700.03018.83
5.4.230.1700.03019.09
5.4.220.1600.04019.08
5.4.210.1670.03319.01
5.4.200.1630.03318.86
5.4.190.1730.04019.03
5.4.180.1930.04019.20
5.4.170.1630.03719.18
5.4.160.1870.04319.07
5.4.150.1530.04718.96
5.4.140.1670.03316.51
5.4.130.1600.03716.56
5.4.120.1600.03716.36
5.4.110.1630.03316.57
5.4.100.1670.03716.50
5.4.90.1970.02716.61
5.4.80.1730.03316.41
5.4.70.1670.04016.49
5.4.60.1830.04716.43
5.4.50.1930.03716.54
5.4.40.2000.03316.43
5.4.30.1670.03316.48
5.4.20.1700.03316.34
5.4.10.1700.03716.55
5.4.00.1700.03715.84
5.3.290.1670.04014.57
5.3.280.1830.04014.68
5.3.270.1770.04714.84
5.3.260.1600.03314.66
5.3.250.2130.03714.58
5.3.240.1770.05014.57
5.3.230.1800.04714.65
5.3.220.2130.04314.50
5.3.210.1800.04314.49
5.3.200.1800.04014.68
5.3.190.1570.03714.45
5.3.180.1600.04314.71
5.3.170.1800.04014.64
5.3.160.1570.04014.54
5.3.150.1830.03314.64
5.3.140.2070.04014.70
5.3.130.1870.04714.63
5.3.120.1670.04014.78
5.3.110.1800.04714.47
5.3.100.1400.04014.01
5.3.90.0000.04014.10
5.3.80.0030.03714.11
5.3.70.0100.06714.11
5.3.60.1700.04013.93
5.3.50.1870.04014.00
5.3.40.1770.03713.87
5.3.30.1700.03713.81
5.3.20.1630.03313.63
5.3.10.1870.04313.73
5.3.00.2070.03713.71
5.2.170.1630.03711.13
5.2.160.1530.03711.07
5.2.150.1570.03311.06
5.2.140.1630.03311.16
5.2.130.1670.03011.16
5.2.120.1600.03311.34
5.2.110.1600.03711.00
5.2.100.1600.03011.04
5.2.90.1570.02711.09
5.2.80.1830.03011.20
5.2.70.1730.03711.18
5.2.60.1600.03311.07
5.2.50.1570.03711.13
5.2.40.1130.04011.00
5.2.30.1230.03711.12
5.2.20.1170.04010.96
5.2.10.1100.03011.01
5.2.00.1130.03310.87
5.1.60.1370.02710.05
5.1.50.1370.0239.88
5.1.40.1100.02010.06
5.1.30.1100.02310.26
5.1.20.1200.02310.23
5.1.10.1130.02710.15
5.1.00.1200.02310.07
5.0.50.0600.0278.49
5.0.40.0530.0238.32
5.0.30.0670.0338.46
5.0.20.0670.0308.34
5.0.10.0470.0238.12
5.0.00.0730.0438.16
4.4.90.0530.0178.12
4.4.80.0600.0138.12
4.4.70.0570.0208.12
4.4.60.0730.0208.12
4.4.50.0530.0178.12
4.4.40.0500.0278.12
4.4.30.0570.0278.12
4.4.20.0600.0138.12
4.4.10.0570.0208.12
4.4.00.0630.0278.12
4.3.110.0600.0208.12
4.3.100.0630.0178.12
4.3.90.0600.0208.12
4.3.80.0600.0308.12
4.3.70.0570.0208.12
4.3.60.0630.0178.12
4.3.50.0600.0138.12
4.3.40.0570.0278.12
4.3.30.0300.0138.12
4.3.20.0030.0208.12
4.3.10.0030.0138.12
4.3.00.0000.0308.12

preferences:
61.21 ms | 401 KiB | 5 Q