3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Trait1 {}; trait Trait2 {}; interface Interface1 {}; interface Interface2 {}; interface Interface3 {}; abstract class Abstract1 implements Interface1 { use Trait1; }; class Class1 extends Abstract1 implements Interface2 {} class Class2 extends Class1 implements Interface3 { use Trait2; } $testObject = new Class2(); echo $testObject instanceof Class2 ? '.' : 'X'; echo $testObject instanceof Class1 ? '.' : 'X'; echo $testObject instanceof Abstract1 ? '.' : 'X'; echo $testObject instanceof Interface3 ? '.' : 'X'; echo $testObject instanceof Interface2 ? '.' : 'X'; echo $testObject instanceof Interface1 ? '.' : 'X'; echo PHP_EOL; echo '----------'.PHP_EOL; $types = getAllTypes($testObject); foreach($types as $type) { echo $type.PHP_EOL; } echo '----------'.PHP_EOL; $types = getAllTypesEasy($testObject); foreach($types as $type) { echo $type.PHP_EOL; } function getAllTypes($object) { $reflection = new ReflectionObject($object); $types = $reflection->getInterfaceNames(); $types[] = get_class($object); $types = array_merge($types, $reflection->getTraitNames()); while($reflection = $reflection->getParentClass()) { $types[] = $reflection->getName(); $types = array_merge($types, $reflection->getTraitNames()); } return $types; } function getAllTypesEasy($object) { return array_merge( [get_class($object)], class_parents($object), class_implements($object), class_uses($object) ); }

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.5.10.0110.00619.88
8.5.00.0100.01020.21
8.4.160.0120.00924.12
8.4.150.0030.00014.05
8.4.140.0110.01117.58
8.4.130.0150.00717.96
8.4.120.0110.00920.56
8.4.110.0100.00820.78
8.4.100.0110.00917.78
8.4.90.0110.01019.51
8.4.80.0110.00917.64
8.4.70.0110.00717.96
8.4.60.0120.00719.18
8.4.50.0080.00019.45
8.4.40.0080.01117.67
8.4.30.0170.00319.15
8.4.20.0000.01617.48
8.4.10.0090.00917.77
8.3.280.0080.00718.41
8.3.270.0130.00816.52
8.3.260.0100.00916.91
8.3.250.0090.01019.34
8.3.240.0110.00916.73
8.3.230.0080.01116.48
8.3.220.0110.00717.35
8.3.210.0050.00316.82
8.3.200.0120.00216.77
8.3.190.0070.00517.34
8.3.180.0060.00316.53
8.3.170.0130.00619.15
8.3.160.0110.00616.85
8.3.150.0030.01618.80
8.3.140.0080.00016.54
8.3.130.0040.00418.32
8.3.120.0090.00619.12
8.3.110.0080.00420.94
8.3.100.0040.00424.06
8.3.90.0000.00726.77
8.3.80.0030.00717.97
8.3.70.0120.00818.57
8.3.60.0150.00318.43
8.3.50.0160.00521.10
8.3.40.0070.01118.78
8.3.30.0140.00418.98
8.3.20.0080.00020.16
8.3.10.0070.00021.76
8.3.00.0040.00718.89
8.2.290.0120.00620.63
8.2.280.0120.00518.07
8.2.270.0130.00717.46
8.2.260.0070.01018.83
8.2.250.0110.00417.23
8.2.240.0090.00618.85
8.2.230.0040.00422.58
8.2.220.0060.00337.54
8.2.210.0000.00926.77
8.2.200.0030.00616.50
8.2.190.0150.00316.89
8.2.180.0060.01218.00
8.2.170.0070.00722.96
8.2.160.0070.01020.39
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00320.90
8.2.110.0030.00619.31
8.2.100.0000.01117.78
8.2.90.0030.00619.76
8.2.80.0050.00319.28
8.2.70.0030.00617.63
8.2.60.0030.00618.03
8.2.50.0060.00318.07
8.2.40.0000.00718.29
8.2.30.0080.00018.16
8.2.20.0020.00517.82
8.2.10.0000.00818.02
8.2.00.0000.00718.17
8.1.330.0090.01021.93
8.1.320.0120.00716.36
8.1.310.0110.00418.46
8.1.300.0060.01218.10
8.1.290.0060.00330.84
8.1.280.0150.00325.92
8.1.270.0090.00023.76
8.1.260.0030.00626.35
8.1.250.0030.00628.09
8.1.240.0060.00322.36
8.1.230.0040.00821.04
8.1.220.0000.00817.79
8.1.210.0030.00619.10
8.1.200.0060.00317.48
8.1.190.0090.00017.35
8.1.180.0000.00818.10
8.1.170.0000.00918.77
8.1.160.0040.00418.96
8.1.150.0030.00518.75
8.1.140.0030.00617.47
8.1.130.0040.00417.89
8.1.120.0040.00417.41
8.1.110.0070.00017.50
8.1.100.0000.00817.51
8.1.90.0070.00017.53
8.1.80.0040.00417.41
8.1.70.0000.00717.51
8.1.60.0060.00317.66
8.1.50.0040.00417.64
8.1.40.0030.00617.56
8.1.30.0050.00317.71
8.1.20.0000.00817.78
8.1.10.0000.00817.70
8.1.00.0080.00017.43
8.0.300.0000.00720.16
8.0.290.0040.00416.75
8.0.280.0020.00518.48
8.0.270.0070.00016.75
8.0.260.0080.00017.34
8.0.250.0000.00716.96
8.0.240.0070.00016.99
8.0.230.0030.00517.02
8.0.220.0040.00416.85
8.0.210.0000.00716.86
8.0.200.0070.00016.97
8.0.190.0000.00716.99
8.0.180.0000.00817.01
8.0.170.0040.00417.02
8.0.160.0000.00817.10
8.0.150.0040.00416.97
8.0.140.0040.00416.82
8.0.130.0050.00013.37
8.0.120.0040.00416.82
8.0.110.0000.00716.96
8.0.100.0000.00816.82
8.0.90.0040.00416.98
8.0.80.0140.00316.91
8.0.70.0000.00716.91
8.0.60.0040.00416.80
8.0.50.0080.00017.02
8.0.30.0050.01217.09
8.0.20.0110.00917.40
8.0.10.0020.00517.02
8.0.00.0110.00816.84
7.4.330.0000.00515.09
7.4.320.0030.00316.57
7.4.300.0030.00316.62
7.4.290.0000.00716.64
7.4.280.0030.00716.46
7.4.270.0030.00316.60
7.4.260.0040.00316.50
7.4.250.0040.00416.61
7.4.240.0020.00516.58
7.4.230.0000.00716.46
7.4.220.0030.01416.55
7.4.210.0070.01116.67
7.4.200.0050.00216.78
7.4.160.0080.00816.38
7.4.150.0110.00717.40
7.4.140.0110.00817.86
7.4.130.0120.00816.71
7.4.120.0140.00516.46
7.4.110.0060.01216.75
7.4.100.0110.00816.72
7.4.90.0120.01216.62
7.4.80.0180.00919.39
7.4.70.0080.01016.59
7.4.60.0110.00616.73
7.4.50.0000.00816.59
7.4.40.0050.01116.40
7.4.30.0060.01216.50
7.4.10.0120.00717.33
7.4.00.0080.00716.52
7.3.330.0030.00313.37
7.3.320.0050.00013.36
7.3.310.0000.00716.39
7.3.300.0030.00316.50
7.3.290.0030.00316.27
7.3.280.0060.01016.46
7.3.270.0090.00917.40
7.3.260.0110.00516.68
7.3.250.0070.01316.47
7.3.240.0120.00416.66
7.3.230.0120.01216.74
7.3.210.0120.00816.50
7.3.200.0030.01419.39
7.3.190.0160.00016.50
7.3.180.0060.01216.72
7.3.170.0080.00816.60
7.3.160.0080.00816.53
7.3.130.0100.00817.31
7.3.120.0080.00817.16
7.3.110.0060.01117.24
7.3.100.0050.01117.19
7.3.90.0090.00917.16
7.3.80.0090.00117.32
7.3.70.0090.00617.24
7.3.60.0040.01017.14
7.3.50.0090.00317.27
7.3.40.0070.00517.11
7.3.30.0070.01217.16
7.3.20.0080.00518.18
7.3.10.0060.00517.68
7.3.00.0060.00617.53
7.2.330.0140.00416.88
7.2.320.0130.00616.89
7.2.310.0080.00916.93
7.2.300.0110.00716.54
7.2.290.0060.01116.82
7.2.260.0080.01217.40
7.2.250.0050.01317.31
7.2.240.0070.01017.36
7.2.230.0080.00917.22
7.2.220.0080.00717.34
7.2.210.0100.00517.26
7.2.200.0050.01017.16
7.2.190.0090.00617.28
7.2.180.0060.00617.34
7.2.170.0040.01317.34
7.2.160.0060.00917.30
7.2.150.0030.01218.11
7.2.140.0080.00618.32
7.2.130.0050.00617.77
7.2.120.0080.00717.72
7.2.110.0080.00517.82
7.2.100.0040.00917.74
7.2.90.0040.00817.81
7.2.80.0050.00617.73
7.2.70.0060.01017.78
7.2.60.0030.01117.77
7.2.50.0080.00517.66
7.2.40.0060.00617.70
7.2.30.0050.00717.70
7.2.20.0060.00917.74
7.2.10.0020.01117.80
7.2.00.0060.00817.69
7.1.330.0070.00917.67
7.1.320.0070.00817.58
7.1.310.0060.00817.69
7.1.300.0050.00817.63
7.1.290.0070.00317.54
7.1.280.0070.00917.63
7.1.270.0000.01017.62
7.1.260.0030.00917.60
7.1.250.0080.00417.06
7.1.240.0030.00617.76
7.1.230.0040.00617.65
7.1.220.0040.00817.67
7.1.210.0050.01017.66
7.1.200.0010.01016.83
7.1.190.0080.00617.65
7.1.180.0050.00517.62
7.1.170.0040.00917.63
7.1.160.0050.00517.49
7.1.150.0050.01017.63
7.1.140.0030.00817.68
7.1.130.0050.00617.62
7.1.120.0050.00717.69
7.1.110.0080.00617.64
7.1.100.0020.01117.63
7.1.90.0090.00617.66
7.1.80.0050.01217.60
7.1.70.0030.00817.49
7.1.60.0310.00417.51
7.1.50.0100.01023.22
7.1.40.0060.00717.65
7.1.30.0090.00617.63
7.1.20.0050.00817.65
7.1.10.0000.01417.49
7.1.00.0020.03119.10
7.0.330.0070.00617.37
7.0.320.0070.00717.43
7.0.310.0050.00817.38
7.0.300.0050.00817.48
7.0.290.0060.00617.44
7.0.280.0050.00617.44
7.0.270.0060.00717.48
7.0.260.0070.00817.50
7.0.250.0080.00417.40
7.0.240.0040.00617.33
7.0.230.0040.00817.46
7.0.220.0070.00717.41
7.0.210.0080.00617.47
7.0.200.0070.00717.21
7.0.190.0080.00617.46
7.0.180.0040.01117.47
7.0.170.0050.00717.53
7.0.160.0050.00817.33
7.0.150.0070.00417.38
7.0.140.0020.00717.54
7.0.130.0090.00517.34
7.0.120.0060.00617.53
7.0.110.0100.00317.52
7.0.100.0030.00817.54
7.0.90.0070.00717.50
7.0.80.0070.00417.50
7.0.70.0040.00917.51
7.0.60.0100.02818.30
7.0.50.0030.02117.62
7.0.40.0050.02817.79
7.0.30.0090.01817.63
7.0.20.0110.02817.69
7.0.10.0040.03117.72
7.0.00.0050.03217.69
5.6.400.0050.00717.09
5.6.390.0060.00816.99
5.6.380.0060.00716.84
5.6.370.0060.00817.12
5.6.360.0020.01017.15
5.6.350.0050.00717.00
5.6.340.0020.01317.10
5.6.330.0080.00717.18
5.6.320.0080.00616.78
5.6.310.0060.00517.05
5.6.300.0050.00616.95
5.6.290.0020.00917.00
5.6.280.0050.02718.25
5.6.270.0050.00617.00
5.6.260.0060.00816.83
5.6.250.0020.01217.01
5.6.240.0060.00917.10
5.6.230.0060.00817.02
5.6.220.0030.00916.90
5.6.210.0070.01918.15
5.6.200.0120.02017.33
5.6.190.0100.02818.21
5.6.180.0130.03218.23
5.6.170.0170.02018.09
5.6.160.0020.03618.19
5.6.150.0050.03117.35
5.6.140.0070.03117.30
5.6.130.0100.01417.33
5.6.120.0060.02218.23
5.6.110.0080.03118.29
5.6.100.0050.03318.30
5.6.90.0080.03518.27
5.6.80.0050.03318.04
5.6.70.0120.00616.94
5.6.60.0030.01016.82
5.6.50.0110.00417.04
5.6.40.0080.00716.87
5.6.30.0050.01016.98
5.6.20.0100.00716.85
5.6.10.0020.01116.86
5.6.00.0050.00816.82
5.5.380.0050.01216.95
5.5.370.0030.01116.93
5.5.360.0080.00817.00
5.5.350.0060.03218.04
5.5.340.0030.03617.26
5.5.330.0070.02818.11
5.5.320.1230.01718.16
5.5.310.0170.02717.93
5.5.300.0050.03117.34
5.5.290.0030.02517.32
5.5.280.0040.02418.12
5.5.270.0090.02018.30
5.5.260.0080.02818.27
5.5.250.0040.02117.99
5.5.240.0140.02717.97
5.5.230.0040.00916.82
5.5.220.0100.00316.91
5.5.210.0020.01016.94
5.5.200.0030.01217.01
5.5.190.0050.00716.73
5.5.180.0080.00316.99
5.5.170.0050.01016.87
5.5.160.0050.00816.96
5.5.150.0050.01016.98
5.5.140.0070.00616.96
5.5.130.0050.00616.83
5.5.120.0030.00816.97
5.5.110.0040.01116.85
5.5.100.0030.01216.74
5.5.90.0060.00817.01
5.5.80.0020.01116.95
5.5.70.0060.00317.04
5.5.60.0100.00316.90
5.5.50.0050.00916.88
5.5.40.0000.01416.88
5.5.30.0020.00816.86
5.5.20.0070.00416.86
5.5.10.0030.00816.79
5.5.00.0020.01116.89
5.4.450.0070.01717.16
5.4.440.0340.02317.25
5.4.430.0350.01617.17
5.4.420.0080.02417.29
5.4.410.0070.02716.98
5.4.400.0070.02417.02
5.4.390.0090.02517.00
5.4.380.0090.02716.93
5.4.370.0070.02717.01
5.4.360.0120.02316.98
5.4.350.0070.02916.98
5.4.340.0050.02316.99
5.4.330.0040.00816.10
5.4.320.0080.01916.99
5.4.310.0080.02817.01
5.4.300.0070.02716.93
5.4.290.0080.02516.91
5.4.280.0100.02216.98
5.4.270.0100.02516.98
5.4.260.0070.02016.91
5.4.250.0050.02916.99
5.4.240.0090.02216.91
5.4.230.0040.02316.92
5.4.220.0080.02116.97
5.4.210.0080.02116.98
5.4.200.0090.01916.25
5.4.190.0050.02217.01
5.4.180.0080.01916.92
5.4.170.0070.02216.88
5.4.160.0050.02116.98
5.4.150.0120.02116.92
5.4.140.0060.01816.22
5.4.130.0020.02616.17
5.4.120.0060.02216.14
5.4.110.0040.02116.15
5.4.100.0080.02216.13
5.4.90.0080.02016.17
5.4.80.0020.02516.18
5.4.70.0130.02216.16
5.4.60.0110.01816.21
5.4.50.0070.02216.15
5.4.40.0060.02416.13
5.4.30.0100.01916.20
5.4.20.0050.02216.16
5.4.10.0060.02016.17
5.4.00.0030.02216.04
5.3.290.0030.06014.71
5.3.280.0130.06314.70
5.3.270.0200.06014.61
5.3.260.0170.06014.52
5.3.250.0170.04714.52
5.3.240.0100.05714.69
5.3.230.0100.06314.64
5.3.220.0130.05714.57
5.3.210.0130.07014.54
5.3.200.0100.05314.48
5.3.190.0070.05314.57
5.3.180.0100.05014.56
5.3.170.0200.04014.46
5.3.160.0070.06314.60
5.3.150.0070.05314.47
5.3.140.0230.06014.61
5.3.130.0170.04314.48
5.3.120.0100.05314.60
5.3.110.0030.05714.53
5.3.100.0130.05313.97
5.3.90.0070.05314.02
5.3.80.0200.04013.92
5.3.70.0170.04314.01
5.3.60.0130.05013.91
5.3.50.0030.05713.85
5.3.40.0170.04713.91
5.3.30.0030.05714.01
5.3.20.0000.05713.59
5.3.10.0100.04713.64
5.3.00.0070.05713.73
5.2.170.0070.04011.07
5.2.160.0070.04011.19
5.2.150.0170.03311.19
5.2.140.0200.03711.20
5.2.130.0000.05711.15
5.2.120.0130.04011.06
5.2.110.0030.04311.05
5.2.100.0130.03711.13
5.2.90.0070.04011.04
5.2.80.0070.05711.07
5.2.70.0170.04311.13
5.2.60.0100.04711.09
5.2.50.0070.04010.99
5.2.40.0100.03710.92
5.2.30.0270.03710.94
5.2.20.0030.04310.96
5.2.10.0130.04711.00
5.2.00.0100.05310.78
5.1.60.0070.03310.03
5.1.50.0130.0409.99
5.1.40.0100.04310.04
5.1.30.0070.03310.29
5.1.20.0030.04010.40
5.1.10.0030.03710.14
5.1.00.0100.04710.04
5.0.50.0030.0408.52
5.0.40.0100.0338.46
5.0.30.0070.0578.24
5.0.20.0070.0338.23
5.0.10.0100.0278.27
5.0.00.0000.0508.20
4.4.90.0070.0235.93
4.4.80.0070.0175.87
4.4.70.0030.0205.86
4.4.60.0070.0175.89
4.4.50.0070.0175.88
4.4.40.0000.0375.85
4.4.30.0030.0205.86
4.4.20.0030.0305.93
4.4.10.0030.0305.94
4.4.00.0100.0375.95
4.3.110.0000.0335.84
4.3.100.0000.0235.79
4.3.90.0000.0235.81
4.3.80.0070.0305.82
4.3.70.0030.0205.88
4.3.60.0030.0205.79
4.3.50.0030.0235.79
4.3.40.0000.0375.80
4.3.30.0030.0204.68
4.3.20.0000.0234.57
4.3.10.0000.0234.47
4.3.00.0030.02015.59

preferences:
26.31 ms | 403 KiB | 5 Q