3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ArraySerializableInterface {} class Bar implements ArraySerializableInterface{ private $event = 'test'; public function dismount() { $object = $this; $reflectionClass = new \ReflectionClass(get_class($object)); $array =[]; foreach ($reflectionClass->getProperties() as $property) { $property->setAccessible(true); $value = $property->getValue($object); if (is_array($value)) { foreach ($value as $name => $foo) { if ($foo instanceof ArraySerializableInterface) { $array[$property->getName()][] = $foo->dismount(); } } continue; } $array[$property->getName()] = $property->getValue($object); $property->setAccessible(false); } return $array; } } class Foo { private $test = 'sd'; private $test2; /** * Constructor. */ public function __construct() { $this->test2 = [ new Bar(), new Bar(), new Bar(), new Bar(), ]; } public function getTest() { return $this->test; } public function getTest2() { return $this->test2; } public function dismount() { $object = $this; $reflectionClass = new \ReflectionClass(get_class($object)); $array =[]; foreach ($reflectionClass->getProperties() as $property) { $property->setAccessible(true); $value = $property->getValue($object); if (is_array($value)) { foreach ($value as $name => $foo) { if ($foo instanceof ArraySerializableInterface) { $array[$property->getName()][] = $foo->dismount(); } } continue; } $array[$property->getName()] = $value; $property->setAccessible(false); } return $array; } } $foo = new Foo; print_r( $foo->dismount());

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.0160.00716.59
8.3.50.0130.00316.29
8.3.40.0040.01218.67
8.3.30.0070.00718.88
8.3.20.0040.00420.38
8.3.10.0040.00421.73
8.3.00.0080.00020.95
8.2.180.0170.00318.29
8.2.170.0040.01122.96
8.2.160.0130.00322.16
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0000.00722.31
8.2.120.0040.00426.35
8.2.110.0030.00720.24
8.2.100.0100.00317.84
8.2.90.0030.00519.30
8.2.80.0030.00517.97
8.2.70.0030.00617.63
8.2.60.0030.00719.66
8.2.50.0100.00018.10
8.2.40.0000.00822.07
8.2.30.0040.00421.09
8.2.20.0000.00718.01
8.2.10.0030.00618.13
8.2.00.0040.00418.13
8.1.280.0070.00725.92
8.1.270.0060.00322.18
8.1.260.0090.00026.35
8.1.250.0020.00528.09
8.1.240.0090.00022.73
8.1.230.0080.00419.08
8.1.220.0050.00317.79
8.1.210.0000.00818.77
8.1.200.0050.00517.35
8.1.190.0030.00717.11
8.1.180.0040.00418.10
8.1.170.0000.00818.53
8.1.160.0000.00719.02
8.1.150.0040.00418.77
8.1.140.0000.00819.58
8.1.130.0000.00718.75
8.1.120.0040.00417.51
8.1.110.0030.00617.45
8.1.100.0080.00017.36
8.1.90.0000.00817.51
8.1.80.0040.00417.50
8.1.70.0000.00817.42
8.1.60.0090.00017.46
8.1.50.0000.00817.44
8.1.40.0040.00417.42
8.1.30.0050.00217.55
8.1.20.0060.00317.57
8.1.10.0000.00817.45
8.1.00.0020.00517.38
8.0.300.0000.00818.77
8.0.290.0040.00416.63
8.0.280.0030.00318.32
8.0.270.0050.00217.25
8.0.260.0060.00016.81
8.0.250.0030.00317.01
8.0.240.0000.00816.79
8.0.230.0070.00016.85
8.0.220.0070.00016.91
8.0.210.0050.00216.79
8.0.200.0060.00016.92
8.0.190.0000.00816.96
8.0.180.0000.00816.98
8.0.170.0000.00816.81
8.0.160.0000.00716.91
8.0.150.0080.00016.83
8.0.140.0040.00416.75
8.0.130.0030.00313.25
8.0.120.0060.00316.86
8.0.110.0070.00016.92
8.0.100.0040.00416.86
8.0.90.0070.00016.96
8.0.80.0080.00816.84
8.0.70.0070.00016.75
8.0.60.0040.00416.94
8.0.50.0040.00416.93
8.0.30.0120.00617.07
8.0.20.0120.00617.40
8.0.10.0050.00216.90
8.0.00.0110.00516.84
7.4.330.0060.00015.55
7.4.320.0060.00016.53
7.4.300.0000.00616.60
7.4.290.0070.00016.51
7.4.280.0060.00316.48
7.4.270.0000.00716.50
7.4.260.0000.00713.29
7.4.250.0000.00716.56
7.4.240.0030.00516.62
7.4.230.0000.00816.32
7.4.220.0090.00916.64
7.4.210.0100.01016.45
7.4.200.0000.00716.39
7.4.160.0070.01016.49
7.4.150.0120.00617.40
7.4.140.0100.00917.86
7.4.130.0130.00616.68
7.4.120.0090.01216.47
7.4.110.0070.01016.30
7.4.100.0130.00316.55
7.4.90.0070.01116.50
7.4.80.0130.00619.39
7.4.70.0110.00616.48
7.4.60.0160.00016.40
7.4.50.0030.00816.68
7.4.40.0150.00716.68
7.4.30.0030.01316.50
7.4.10.0110.00414.92
7.4.00.0070.00915.03
7.3.330.0000.00513.36
7.3.320.0050.00013.44
7.3.310.0000.00816.38
7.3.300.0000.00616.34
7.3.290.0080.00716.36
7.3.280.0090.00716.34
7.3.270.0100.00717.40
7.3.260.0060.01116.54
7.3.250.0110.01116.43
7.3.240.0120.00516.60
7.3.230.0100.01016.44
7.3.210.0060.01216.45
7.3.200.0130.00316.44
7.3.190.0060.01216.49
7.3.180.0060.01016.57
7.3.170.0030.01316.40
7.3.160.0060.00916.51
7.3.130.0060.01315.01
7.3.120.0100.00714.75
7.3.110.0090.00615.05
7.3.100.0060.00914.90
7.3.90.0030.01015.08
7.3.80.0080.00414.71
7.3.70.0030.00614.80
7.3.60.0090.00614.66
7.3.50.0060.00314.54
7.3.40.0060.00615.00
7.3.30.0080.00814.83
7.3.20.0030.00916.55
7.3.10.0070.01016.73
7.3.00.0040.00716.66
7.2.330.0030.01516.83
7.2.320.0090.00916.62
7.2.310.0100.00616.65
7.2.300.0000.01716.83
7.2.290.0060.01516.91
7.2.260.0120.00615.32
7.2.250.0090.00915.12
7.2.240.0030.01015.12
7.2.230.0070.01014.96
7.2.220.0090.00915.14
7.2.210.0060.00615.29
7.2.200.0100.00715.26
7.2.190.0060.00915.08
7.2.180.0000.01214.95
7.2.170.0030.01014.90
7.2.160.0120.00414.85
7.2.150.0110.00316.86
7.2.140.0130.00617.09
7.2.130.0000.01117.03
7.2.120.0080.00816.74
7.2.110.0070.01017.02
7.2.100.0040.01217.01
7.2.90.0070.01016.89
7.2.80.0070.01016.81
7.2.70.0050.00516.63
7.2.60.0070.00517.08
7.2.50.0100.00717.08
7.2.40.0060.00316.86
7.2.30.0120.00316.86
7.2.20.0000.01116.95
7.2.10.0060.00916.92
7.2.00.0110.00416.96
7.1.330.0040.01115.70
7.1.320.0040.01115.87
7.1.310.0110.00415.63
7.1.300.0040.00415.98
7.1.290.0030.00615.92
7.1.280.0060.00615.58
7.1.270.0000.01515.61
7.1.260.0050.01015.87
7.1.250.0000.01415.99
7.1.240.0000.01415.76
7.1.230.0070.00715.85
7.1.220.0030.00915.58
7.1.210.0070.00715.89
7.1.200.0040.01015.83
7.1.190.0030.01215.79
7.1.180.0040.00815.48
7.1.170.0030.00915.95
7.1.160.0060.00915.57
7.1.150.0100.00015.86
7.1.140.0110.00015.75
7.1.130.0070.00715.88
7.1.120.0070.00715.70
7.1.110.0000.01115.77
7.1.100.0120.00015.77
7.1.90.0030.00915.80
7.1.80.0030.00515.59
7.1.70.0070.00116.54
7.1.60.0310.00824.43
7.1.50.0280.01124.48
7.1.40.0370.00324.31
7.1.30.0400.00824.02
7.1.20.0330.01124.17
7.1.10.0280.01015.43
7.1.00.0250.01015.38
7.0.330.0040.01115.50
7.0.320.0060.00515.46
7.0.310.0030.01015.41
7.0.300.0100.00315.55
7.0.290.0000.01215.27
7.0.280.0100.00315.28
7.0.270.0040.00415.25
7.0.260.0030.00515.41
7.0.250.0030.00515.64
7.0.240.0140.00015.50
7.0.230.0000.01615.43
7.0.220.0030.00815.64
7.0.210.0070.00715.36
7.0.200.0240.00715.19
7.0.190.0230.01015.17
7.0.180.0280.00815.00
7.0.170.0280.01015.06
7.0.160.0250.01314.87
7.0.150.0250.01014.94
7.0.140.0330.01215.05
7.0.130.0190.00815.19
7.0.120.0210.00615.04
7.0.110.0180.00715.04
7.0.100.0140.00915.14
7.0.90.0160.00514.87
7.0.80.0190.00514.90
7.0.70.0180.00815.12
7.0.60.0140.00914.90
7.0.50.0120.00915.07
7.0.40.0180.00514.23
7.0.30.0180.00614.05
7.0.20.0100.01214.08
7.0.10.0550.00713.95
7.0.00.0130.01213.98
5.6.400.0070.01114.59
5.6.390.0120.00314.30
5.6.380.0040.01414.83
5.6.370.0060.01214.80
5.6.360.0130.00314.81
5.6.350.0030.00614.78
5.6.340.0060.00614.38
5.6.330.0000.01814.31
5.6.320.0060.00614.72
5.6.310.0060.00914.92
5.6.300.0100.00314.66
5.6.290.0060.00914.32
5.6.280.0000.00914.21
5.6.270.0080.00314.64
5.6.260.0060.00314.55
5.6.250.0040.01214.68
5.6.240.0060.00614.36
5.6.230.0100.00314.36
5.6.220.0090.00314.58
5.6.210.0060.00314.57
5.6.200.0030.00914.34
5.6.190.0080.00414.47
5.6.180.0150.00014.59
5.6.170.0080.00414.27
5.6.160.0100.00614.59
5.6.150.0140.00014.80
5.6.140.0000.01714.39
5.6.130.0060.00914.67
5.6.120.0070.00714.26
5.6.110.0070.01014.51
5.6.100.0070.00714.61
5.6.90.0040.00814.38
5.6.80.0030.00614.52
5.6.70.0130.00314.20
5.6.60.0000.01214.31
5.6.50.0140.00314.41
5.6.40.0030.01214.26
5.6.30.0090.00614.76
5.6.20.0040.00814.47
5.6.10.0060.00614.47
5.6.00.0070.00414.45

preferences:
43.58 ms | 400 KiB | 5 Q