3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a; } class B extends A { public $b; } $a = new B(); $a->a = 0; $a->b = 1; $b = new B(); $b->a = 1; $b->b = 0; // This compare walks the properties_table in both objects directly, resulting in ->a being compared first. // Call this: Direct Compare // Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L1517 var_dump($a < $b); // print_r() (or several other potential actions) forces the properties HashTable to be materialized, // It's not the output of this that matters, so ignore it. print_r($a, true); // Now that one of the objects has a HashTable version, we materialize the other and walk that instead. // Ordering of properties in properties_info is not (necessarily) the same as in the property slots. // Call this: HashTable Compare // Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L1569 // Ref: https://github.com/php/php-src/blob/b151e17bdfca573e0205cc90dc710f89d77f03cf/Zend/zend_object_handlers.c#L70 var_dump($a < $b); // But all of the above about ordering is basically irrelevant since the Direct Compare algorith only returns 0 or 1 for equal/in-equal. The HashTable comparison returns a -1/0/1 tripple for actual relops comparisons. // Start over: unset($a, $b); $a = new B(); $a->a = 0; $a->b = 1; $b = new B(); $b->a = 1; $b->b = 0; var_dump($a < $b); var_dump($b < $a);

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.0100.00816.68
8.5.00.0130.00921.61
8.4.160.0100.01223.90
8.4.150.0020.00014.05
8.4.140.0130.00917.83
8.4.130.0140.00618.72
8.4.120.0120.00823.97
8.4.110.0120.00819.03
8.4.100.0110.00918.58
8.4.90.0100.01022.34
8.4.80.0040.00520.32
8.4.70.0080.00318.04
8.4.60.0160.00418.93
8.4.50.0090.00518.48
8.4.40.0030.00717.53
8.4.30.0140.01017.77
8.4.20.0130.00620.71
8.4.10.0030.00617.68
8.3.280.0120.00818.17
8.3.270.0120.01116.64
8.3.260.0050.00416.75
8.3.250.0050.00219.13
8.3.240.0090.01016.93
8.3.230.0080.01116.54
8.3.220.0080.00619.01
8.3.210.0110.00816.79
8.3.200.0040.00516.57
8.3.190.0080.00617.23
8.3.180.0140.00617.11
8.3.170.0110.00720.60
8.3.160.0070.01016.95
8.3.150.0000.00917.23
8.3.140.0110.00416.67
8.3.130.0030.00618.38
8.3.120.0110.00720.77
8.3.110.0050.00516.50
8.3.100.0090.00016.91
8.3.90.0080.00016.66
8.3.80.0030.00617.97
8.3.70.0140.00718.56
8.3.60.0110.00718.55
8.3.50.0060.00718.10
8.3.40.0040.01218.85
8.3.30.0090.00918.70
8.3.20.0060.00319.16
8.3.10.0040.00423.71
8.3.00.0040.00423.53
8.2.290.0130.00520.44
8.2.280.0110.00718.50
8.2.270.0150.00317.36
8.2.260.0080.00016.57
8.2.250.0090.00616.30
8.2.240.0170.00318.79
8.2.230.0120.00422.58
8.2.220.0060.00324.06
8.2.210.0040.00426.77
8.2.200.0060.00318.42
8.2.190.0070.00716.75
8.2.180.0060.00916.50
8.2.170.0150.00022.96
8.2.160.0100.00320.39
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0000.00822.11
8.2.120.0080.00026.35
8.2.110.0070.00320.86
8.2.100.0040.00817.84
8.2.90.0030.00617.91
8.2.80.0030.00617.97
8.2.70.0000.00918.03
8.2.60.0000.01217.97
8.2.50.0050.00318.10
8.2.40.0040.00419.28
8.2.30.0030.00320.50
8.2.20.0070.00018.00
8.2.10.0000.00717.95
8.2.00.0040.00419.48
8.1.330.0140.00521.96
8.1.320.0120.00816.25
8.1.310.0090.00018.70
8.1.300.0060.00616.66
8.1.290.0060.00318.88
8.1.280.0090.00625.92
8.1.270.0040.00423.96
8.1.260.0000.00726.35
8.1.250.0050.00228.09
8.1.240.0060.00322.01
8.1.230.0070.00320.87
8.1.220.0070.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0050.00317.22
8.1.180.0040.00418.10
8.1.170.0000.00718.75
8.1.160.0040.00418.94
8.1.150.0000.00718.88
8.1.140.0000.00818.90
8.1.130.0040.00419.01
8.1.120.0000.00817.46
8.1.110.0040.00417.35
8.1.100.0060.00317.33
8.1.90.0040.00417.36
8.1.80.0050.00317.41
8.1.70.0070.00017.46
8.1.60.0060.00317.64
8.1.50.0060.00317.48
8.1.40.0040.00417.43
8.1.30.0000.00817.66
8.1.20.0000.01117.58
8.1.10.0060.00317.61
8.1.00.0080.00017.39
8.0.300.0060.00319.63
8.0.290.0040.00716.63
8.0.280.0000.00818.45
8.0.270.0000.00717.22
8.0.260.0030.00317.27
8.0.250.0030.00316.98
8.0.240.0030.00316.93
8.0.230.0030.00316.87
8.0.220.0030.00316.96
8.0.210.0000.00716.82
8.0.200.0000.00616.84
8.0.190.0000.00716.96
8.0.180.0000.00716.80
8.0.170.0030.00616.89
8.0.160.0040.00416.89
8.0.150.0030.00516.84
8.0.140.0050.00316.77
8.0.130.0000.00613.28
8.0.120.0040.00416.79
8.0.110.0000.00816.95
8.0.100.0040.00416.96
8.0.90.0050.00216.96
8.0.80.0100.00816.88
8.0.70.0070.00016.82
8.0.60.0000.00716.84
8.0.50.0000.00716.72
8.0.30.0090.00716.94
8.0.20.0090.01117.40
8.0.10.0040.00417.13
8.0.00.0090.01516.70
7.4.330.0060.00015.55
7.4.320.0070.00016.53
7.4.300.0000.00716.45
7.4.290.0000.00716.51
7.4.280.0040.00416.41
7.4.270.0070.00016.41
7.4.260.0000.00716.56
7.4.250.0000.00816.61
7.4.240.0030.00316.56
7.4.230.0060.00316.43
7.4.220.0070.00016.61
7.4.210.0080.01116.46
7.4.200.0000.00816.63
7.4.160.0110.00916.47
7.4.140.0120.00717.86
7.4.130.0150.00316.67
7.4.120.0100.01016.48
7.4.110.0060.01016.57
7.4.100.0180.00616.37
7.4.90.0060.01216.46
7.4.80.0070.01419.39
7.4.70.0160.00516.46
7.4.60.0070.01016.59
7.4.50.0030.01016.50
7.4.40.0110.00816.43
7.4.00.0100.00714.80
7.3.330.0000.00513.09
7.3.320.0030.00313.29
7.3.310.0040.00316.20
7.3.300.0060.00016.16
7.3.290.0060.00016.30
7.3.280.0110.00716.24
7.3.260.0100.00816.49
7.3.240.0120.00916.39
7.3.230.0070.01016.43
7.3.210.0110.00716.55
7.3.200.0070.00916.43
7.3.190.0030.01316.50
7.3.180.0090.01216.39
7.3.170.0130.00316.61
7.3.160.0080.01316.18
7.2.330.0150.01016.61
7.2.320.0140.00616.63
7.2.310.0150.00916.70
7.2.300.0030.01416.50
7.2.290.0160.01016.38
7.2.80.0420.01314.53
7.2.70.0620.01114.88
7.2.60.0660.00714.65
7.2.50.0620.01015.07
7.2.40.0540.00714.78
7.2.30.0990.01014.68
7.2.20.0680.00714.75
7.2.10.0540.00714.93
7.2.00.0550.00614.88
7.1.200.0550.00313.77
7.1.190.0690.00313.80
7.1.180.0610.00913.54
7.1.170.0450.01613.58
7.1.160.0780.00013.59
7.1.150.1600.00714.15
7.1.140.0640.01313.54
7.1.130.0450.01013.80
7.1.120.0490.01314.05
7.1.110.0620.00013.79
7.1.100.0760.00613.98
7.1.90.0590.00013.49
7.1.80.0600.00313.80
7.1.70.0490.01013.69
7.1.60.0860.00631.67
7.1.50.0900.00731.84
7.1.40.0650.00931.89
7.1.30.0740.00731.51
7.1.20.0680.00731.78
7.1.10.0580.00313.81
7.1.00.0510.00613.61

preferences:
40 ms | 403 KiB | 5 Q