3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Currency { public $currencyCode; public function __construct($currencyCode) { $this->currencyCode = $currencyCode; } public function equals(Currency $currency) { return $this->currencyCode === $currency->currencyCode; } } class Money { public $amount; public $currency; public function __construct($amount, Currency $currency = null) { $this->currency = $currency ?: new Currency('USD'); } } echo "True/Object comparison with loosy operator:\r\n"; var_dump(new Money(55) == true); echo "True/Object comparision with strict operator:\r\n"; var_dump(new Money(55) === true); echo "False/Null comparison with loose operator:\r\n"; var_dump(null == false); echo "False/Null comparision with strict operator:\r\n"; var_dump(null === false); // $currency is passed in, $currency == true $revenue = new Money(55, new Currency('GBP')); echo "Short-hand ternary when currency is set:\r\n"; var_dump($revenue->currency->equals(new Currency('GBP'))); // $currency is null, $currency == false $assets = new Money(55); echo "Short-hand ternary when currency is not set:\r\n"; var_dump($assets->currency->equals(new Currency('USD')));

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.0090.00918.23
8.3.50.0070.01622.18
8.3.40.0090.00618.98
8.3.30.0120.00319.04
8.3.20.0040.00420.33
8.3.10.0060.00320.65
8.3.00.0040.00419.69
8.2.180.0070.01116.63
8.2.170.0070.01122.96
8.2.160.0070.00720.44
8.2.150.0070.00024.18
8.2.140.0090.00024.66
8.2.130.0070.00326.16
8.2.120.0040.00422.06
8.2.110.0080.00319.20
8.2.100.0100.00317.72
8.2.90.0000.00819.02
8.2.80.0080.00017.97
8.2.70.0060.00317.63
8.2.60.0080.00018.03
8.2.50.0050.00318.10
8.2.40.0070.00318.08
8.2.30.0070.00019.25
8.2.20.0040.00417.76
8.2.10.0000.00818.07
8.2.00.0030.00617.60
8.1.280.0130.00725.92
8.1.270.0080.00022.06
8.1.260.0020.00526.35
8.1.250.0060.00328.09
8.1.240.0030.00623.80
8.1.230.0090.00317.77
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.00817.47
8.1.190.0080.00017.23
8.1.180.0030.00518.10
8.1.170.0040.00418.57
8.1.160.0020.00522.00
8.1.150.0040.00418.91
8.1.140.0050.00317.38
8.1.130.0030.00317.74
8.1.120.0040.00417.40
8.1.110.0070.00017.49
8.1.100.0000.00717.52
8.1.90.0050.00217.48
8.1.80.0070.00017.35
8.1.70.0030.00317.41
8.1.60.0030.00617.63
8.1.50.0030.00617.59
8.1.40.0060.00317.45
8.1.30.0030.00517.64
8.1.20.0050.00317.68
8.1.10.0050.00317.47
8.1.00.0050.00717.53
8.0.300.0070.00018.77
8.0.290.0000.00716.88
8.0.280.0040.00418.46
8.0.270.0080.00017.28
8.0.260.0070.00017.28
8.0.250.0000.00717.14
8.0.240.0030.00317.10
8.0.230.0070.00016.93
8.0.220.0030.00316.84
8.0.210.0040.00416.96
8.0.200.0000.00716.96
8.0.190.0000.01116.95
8.0.180.0030.00516.90
8.0.170.0060.00317.03
8.0.160.0030.00317.01
8.0.150.0070.00016.98
8.0.140.0030.00516.81
8.0.130.0000.00613.36
8.0.120.0080.00016.84
8.0.110.0000.00716.99
8.0.100.0030.00616.96
8.0.90.0040.00416.88
8.0.80.0130.00316.96
8.0.70.0040.00417.04
8.0.60.0000.00816.86
8.0.50.0000.00716.86
8.0.30.0080.01417.22
8.0.20.0120.00617.40
8.0.10.0030.00417.21
8.0.00.0040.01516.86
7.4.330.0030.00315.00
7.4.320.0030.00316.68
7.4.300.0030.00316.48
7.4.290.0040.00416.63
7.4.280.0040.00416.48
7.4.270.0040.00416.70
7.4.260.0000.00716.66
7.4.250.0070.00016.63
7.4.240.0000.00716.58
7.4.230.0000.00616.45
7.4.220.0160.00016.71
7.4.210.0030.01116.73
7.4.200.0040.00416.61
7.4.160.0080.00816.59
7.4.150.0080.01217.40
7.4.140.0140.00317.86
7.4.130.0070.01016.55
7.4.120.0080.01016.54
7.4.110.0080.00816.52
7.4.100.0110.00616.55
7.4.90.0160.00016.44
7.4.80.0030.01516.60
7.4.70.0040.01216.34
7.4.60.0120.00416.56
7.4.50.0080.00016.67
7.4.40.0110.00616.39
7.4.30.0060.01416.40
7.4.00.0120.00515.04
7.3.330.0050.00013.32
7.3.320.0000.00513.21
7.3.310.0040.00416.43
7.3.300.0050.00316.20
7.3.290.0000.01416.39
7.3.280.0110.00616.40
7.3.270.0090.00917.40
7.3.260.0100.01016.34
7.3.250.0120.00516.60
7.3.240.0130.00916.64
7.3.230.0140.00316.40
7.3.210.0160.00016.33
7.3.200.0090.01419.39
7.3.190.0110.00516.41
7.3.180.0130.01016.36
7.3.170.0100.00716.46
7.3.160.0120.00916.47
7.3.120.0000.01714.92
7.3.110.0110.00714.91
7.3.100.0060.00915.12
7.3.90.0030.01014.63
7.3.80.0100.01015.04
7.3.70.0070.00714.73
7.3.60.0040.01115.00
7.3.50.0090.00614.93
7.3.40.0030.00714.93
7.3.30.0030.01014.90
7.3.20.0030.01016.56
7.3.10.0060.00616.55
7.3.00.0090.00616.70
7.2.330.0110.00716.84
7.2.320.0120.00616.91
7.2.310.0100.01316.80
7.2.300.0060.01516.71
7.2.290.0100.00716.86
7.2.250.0070.01315.21
7.2.240.0070.01415.32
7.2.230.0120.00615.24
7.2.220.0100.00314.84
7.2.210.0110.01115.09
7.2.200.0070.00715.04
7.2.190.0070.00715.11
7.2.180.0060.01215.26
7.2.170.0100.00015.10
7.2.60.0090.00616.58
7.2.00.0030.00919.41
7.1.330.0060.00915.79
7.1.320.0090.00615.85
7.1.310.0130.00715.79
7.1.300.0030.01015.82
7.1.290.0060.01115.85
7.1.280.0050.00515.62
7.1.270.0030.01015.79
7.1.260.0100.00715.54
7.1.200.0070.00315.84
7.1.100.0970.01316.32
7.1.70.0000.01117.09
7.1.60.0060.01919.32
7.1.50.0110.01117.03
7.1.00.0000.08022.40
7.0.200.0070.00416.64
7.0.140.0130.06322.00
7.0.60.0130.06319.81
7.0.50.0100.05317.91
7.0.40.0070.05019.97
7.0.30.0530.07020.09
7.0.20.0330.08320.16
7.0.10.0070.08720.23
7.0.00.0200.07720.19
5.6.280.0100.07020.83
5.6.210.0000.04320.64
5.6.200.0130.08018.23
5.6.190.0030.05020.41
5.6.180.3630.04320.33
5.6.170.0370.07320.54
5.6.160.0070.05720.50
5.6.150.0030.07018.25
5.6.140.0030.04318.18
5.6.130.0030.08318.29
5.6.120.0030.05021.13
5.6.110.0030.06321.06
5.6.100.0030.07021.12
5.6.90.0070.04720.98
5.6.80.0070.08020.41
5.6.70.0330.07320.44
5.5.350.0230.07320.40
5.5.340.0030.04717.97
5.5.330.0070.05020.40
5.5.320.0330.03720.21
5.5.310.0300.08020.24
5.5.300.0030.08717.98
5.5.290.0100.07717.97
5.5.280.0130.04020.88
5.5.270.0100.07720.88
5.5.260.0030.09320.86
5.5.250.0030.08720.79
5.5.240.0230.06720.07
5.4.450.0900.05019.58
5.4.440.0770.05319.52
5.4.430.0830.06719.46
5.4.420.0370.06719.45
5.4.410.1000.04319.36
5.4.400.0570.06018.86
5.4.390.1000.05319.15
5.4.380.0270.07318.82
5.4.370.0300.05018.63
5.4.360.0330.05718.80
5.4.350.0330.05718.75
5.4.340.0270.06018.48
5.4.320.0100.03112.51
5.4.310.0100.04212.51
5.4.300.0070.03612.51
5.4.290.0070.04112.50
5.4.280.0070.03912.41
5.4.270.0070.03512.40
5.4.260.0060.03612.40
5.4.250.0050.05312.40
5.4.240.0100.03612.40
5.4.230.0090.03412.40
5.4.220.0040.03812.39
5.4.210.0040.03712.39
5.4.200.0060.03912.39
5.4.190.0060.03812.39
5.4.180.0100.03712.39
5.4.170.0120.04112.40
5.4.160.0050.03612.39
5.4.150.0070.04912.39
5.4.140.0070.03712.07
5.4.130.0060.04212.07
5.4.120.0050.04112.03
5.4.110.0050.03812.02
5.4.100.0060.04012.02
5.4.90.0030.04212.02
5.4.80.0070.03812.02
5.4.70.0100.04012.02
5.4.60.0070.03712.02
5.4.50.0090.03412.02
5.4.40.0090.03212.01
5.4.30.0080.03712.00
5.4.20.0080.03712.00
5.4.10.0070.03312.00
5.4.00.0030.04111.49
5.3.290.0110.04412.80
5.3.280.0060.05212.71
5.3.270.0050.04512.73
5.3.260.0070.04412.72
5.3.250.0050.04512.72
5.3.240.0080.04612.72
5.3.230.0050.03812.71
5.3.220.0070.04112.68
5.3.210.0070.04512.68
5.3.200.0070.04512.68
5.3.190.0050.04412.68
5.3.180.0060.03912.68
5.3.170.0060.04012.67
5.3.160.0090.03612.68
5.3.150.0080.04512.67
5.3.140.0060.04312.66
5.3.130.0100.03912.66
5.3.120.0060.04212.66
5.3.110.0090.03612.66
5.3.100.0090.04112.13
5.3.90.0070.03812.11
5.3.80.0090.04112.10
5.3.70.0110.03412.10
5.3.60.0040.05112.09
5.3.50.0060.03812.03
5.3.40.0040.05012.03
5.3.30.0070.03611.99
5.3.20.0070.03811.77
5.3.10.0080.03911.74
5.3.00.0120.03611.73
5.2.170.0090.0299.22
5.2.160.0060.0369.23
5.2.150.0080.0309.22
5.2.140.0040.0319.22
5.2.130.0050.0339.18
5.2.120.0050.0299.18
5.2.110.0040.0379.20
5.2.100.0070.0369.20
5.2.90.0050.0319.19
5.2.80.0040.0299.18
5.2.70.0050.0309.18
5.2.60.0050.0299.13
5.2.50.0030.0329.11
5.2.40.0040.0339.08
5.2.30.0040.0309.06
5.2.20.0040.0339.05
5.2.10.0040.0408.95
5.2.00.0050.0398.82
5.1.60.0050.0308.10
5.1.50.0050.0238.10
5.1.40.0040.0258.07
5.1.30.0050.0258.43
5.1.20.0050.0308.45
5.1.10.0060.0318.18
5.1.00.0070.0298.18
5.0.50.0050.0236.66
5.0.40.0050.0236.51
5.0.30.0040.0396.32
5.0.20.0030.0196.29
5.0.10.0040.0266.27
5.0.00.0020.0406.27
4.4.90.0040.0244.78
4.4.80.0040.0154.75
4.4.70.0000.0254.75
4.4.60.0030.0164.75
4.4.50.0040.0194.77
4.4.40.0050.0274.71
4.4.30.0010.0214.76
4.4.20.0050.0134.84
4.4.10.0030.0184.85
4.4.00.0050.0264.76
4.3.110.0030.0204.67
4.3.100.0030.0174.66
4.3.90.0030.0184.64
4.3.80.0050.0264.58
4.3.70.0020.0194.63
4.3.60.0020.0194.63
4.3.50.0070.0214.63
4.3.40.0020.0244.54
4.3.30.0020.0163.30
4.3.20.0020.0153.28
4.3.10.0020.0153.24
4.3.00.0130.0238.16

preferences:
52.04 ms | 401 KiB | 5 Q