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 (should be true):\r\n"; var_dump(new Money(55) == true); echo "True/Object comparision with strict operator (should be false):\r\n"; var_dump(new Money(55) === true); echo "False/Null comparison with loose operator (should be true):\r\n"; var_dump(null == false); echo "False/Null comparision with strict operator (should be false):\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 (should be true):\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 (should be true):\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.0070.01018.18
8.3.50.0150.00721.94
8.3.40.0110.00418.83
8.3.30.0070.00719.21
8.3.20.0000.00720.20
8.3.10.0040.00420.48
8.3.00.0050.00319.80
8.2.180.0090.00916.63
8.2.170.0150.00322.96
8.2.160.0100.00320.58
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0030.00726.16
8.2.120.0020.00522.13
8.2.110.0040.00819.30
8.2.100.0110.00817.45
8.2.90.0090.00019.36
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0040.00417.93
8.2.50.0040.00418.10
8.2.40.0070.00318.16
8.2.30.0040.00719.29
8.2.20.0030.00617.77
8.2.10.0000.00817.96
8.2.00.0040.00417.81
8.1.280.0140.00425.92
8.1.270.0090.00622.02
8.1.260.0050.00226.35
8.1.250.0030.00628.09
8.1.240.0030.00723.92
8.1.230.0060.00617.83
8.1.220.0000.00817.76
8.1.210.0030.00618.77
8.1.200.0080.00017.23
8.1.190.0000.00817.22
8.1.180.0050.00318.10
8.1.170.0050.00318.67
8.1.160.0040.00422.04
8.1.150.0000.00718.92
8.1.140.0030.00517.48
8.1.130.0030.00317.86
8.1.120.0040.00417.51
8.1.110.0040.00417.44
8.1.100.0000.00717.47
8.1.90.0030.00317.56
8.1.80.0000.00717.57
8.1.70.0030.00317.46
8.1.60.0000.01117.63
8.1.50.0030.00517.45
8.1.40.0000.00717.54
8.1.30.0040.00417.68
8.1.20.0000.00717.70
8.1.10.0040.00417.53
8.1.00.0000.00917.58
8.0.300.0040.00418.77
8.0.290.0000.00816.88
8.0.280.0000.00718.41
8.0.270.0040.00417.16
8.0.260.0000.00717.29
8.0.250.0030.00316.96
8.0.240.0000.00716.96
8.0.230.0000.00716.94
8.0.220.0000.00716.88
8.0.210.0030.00616.92
8.0.200.0070.00017.02
8.0.190.0040.00817.09
8.0.180.0000.00817.04
8.0.170.0090.00016.84
8.0.160.0040.00417.06
8.0.150.0040.00416.81
8.0.140.0000.00816.99
8.0.130.0060.00013.39
8.0.120.0080.00017.01
8.0.110.0040.00416.95
8.0.100.0040.00416.76
8.0.90.0080.00016.83
8.0.80.0060.00916.96
8.0.70.0040.00416.86
8.0.60.0000.00817.02
8.0.50.0070.00017.05
8.0.30.0090.00917.30
8.0.20.0110.01117.40
8.0.10.0070.00017.16
8.0.00.0060.01517.04
7.4.330.0050.00015.11
7.4.320.0000.00716.56
7.4.300.0070.00016.59
7.4.290.0000.00716.66
7.4.280.0000.00716.68
7.4.270.0000.00716.64
7.4.260.0000.00716.67
7.4.250.0000.00716.63
7.4.240.0030.00316.61
7.4.230.0030.00316.71
7.4.220.0030.01416.76
7.4.210.0030.01416.65
7.4.200.0000.00716.67
7.4.160.0150.00416.53
7.4.150.0150.00417.40
7.4.140.0070.01017.86
7.4.130.0060.01116.52
7.4.120.0170.00516.55
7.4.110.0090.01116.76
7.4.100.0110.00716.61
7.4.90.0070.01716.64
7.4.80.0150.00916.50
7.4.70.0060.01116.40
7.4.60.0130.00316.59
7.4.50.0030.00516.63
7.4.40.0070.01016.58
7.4.30.0030.01616.55
7.4.00.0000.01814.69
7.3.330.0030.00313.21
7.3.320.0050.00013.24
7.3.310.0030.00516.27
7.3.300.0000.00716.38
7.3.290.0030.01016.43
7.3.280.0080.00916.40
7.3.270.0110.00917.40
7.3.260.0030.01416.29
7.3.250.0160.00516.46
7.3.240.0140.00916.81
7.3.230.0060.01216.55
7.3.210.0140.00316.42
7.3.200.0130.01019.39
7.3.190.0090.00816.68
7.3.180.0140.00416.42
7.3.170.0090.00616.62
7.3.160.0100.01016.61
7.3.10.0100.00616.47
7.3.00.0160.00516.28
7.2.330.0140.00716.59
7.2.320.0120.00616.75
7.2.310.0060.01216.92
7.2.300.0130.00316.53
7.2.290.0100.00616.69
7.2.130.0140.01016.62
7.2.120.0140.01216.72
7.2.110.0120.00916.78
7.2.100.0140.00916.71
7.2.90.0120.00916.63
7.2.80.0120.01016.79
7.2.70.0110.00816.84
7.2.60.0120.00716.57
7.2.50.0130.00516.62
7.2.40.0110.00916.70
7.2.30.0060.01116.62
7.2.20.0150.00516.84
7.2.10.0050.00916.70
7.2.00.0150.01016.90
7.1.250.0110.00715.54
7.1.200.0030.00615.82
7.1.70.0030.00917.19
7.1.60.0100.01319.32
7.1.50.0090.00916.98
7.1.00.0030.07722.30
7.0.200.0000.00816.80
7.0.140.0030.07322.12
7.0.60.0030.04719.90
7.0.50.0100.08017.97
7.0.40.0070.05320.21
7.0.30.0170.04020.28
7.0.20.0270.07320.08
7.0.10.0070.07320.26
7.0.00.0030.04020.05
5.6.280.0070.07021.16
5.6.210.0070.06720.54
5.6.200.0030.04018.15
5.6.190.0070.04020.47
5.6.180.0530.07320.50
5.6.170.0370.05320.39
5.6.160.0000.05720.55
5.6.150.0100.04718.18
5.6.140.0130.07318.21
5.6.130.0170.04718.13
5.6.120.0070.04020.85
5.6.110.0100.07321.08
5.6.100.0100.07721.15
5.6.90.0100.06320.96
5.6.80.0170.07020.38
5.5.350.0270.07020.50
5.5.340.0070.07317.95
5.5.330.0000.04320.29
5.5.320.0330.07020.33
5.5.310.0230.08020.25
5.5.300.0000.04318.04
5.5.290.0170.07718.03
5.5.280.0130.07720.89
5.5.270.0100.08320.88
5.5.260.0100.03320.97
5.5.250.0030.08320.67
5.5.240.0130.07320.27
5.4.450.0330.06019.30
5.4.440.0970.05019.70
5.4.430.0970.05319.47
5.4.420.1030.05319.54
5.4.410.0700.04019.57
5.4.400.0930.05719.13
5.4.390.0100.05319.16
5.4.380.0330.06318.48
5.4.370.0270.06018.63
5.4.360.0300.05018.80
5.4.350.0200.06318.59
5.4.340.0300.06018.81
5.4.320.0090.03912.52
5.4.310.0060.04112.51
5.4.300.0060.04512.52
5.4.290.0060.04212.51
5.4.280.0090.03912.40
5.4.270.0070.03812.40
5.4.260.0130.04112.41
5.4.250.0100.04512.41
5.4.240.0040.04312.41
5.4.230.0080.04112.40
5.4.220.0090.03912.40
5.4.210.0080.03912.40
5.4.200.0080.03812.40
5.4.190.0070.03712.39
5.4.180.0060.04412.39
5.4.170.0080.04412.40
5.4.160.0080.03712.40
5.4.150.0070.03512.39
5.4.140.0100.03912.08
5.4.130.0050.04112.07
5.4.120.0080.04112.03
5.4.110.0060.04712.02
5.4.100.0070.04112.02
5.4.90.0120.03612.02
5.4.80.0060.04112.02
5.4.70.0080.03612.02
5.4.60.0070.03312.02
5.4.50.0070.03512.02
5.4.40.0060.03412.01
5.4.30.0080.03911.99
5.4.20.0080.03612.00
5.4.10.0050.04312.00
5.4.00.0050.04011.49
5.3.290.0110.03912.80
5.3.280.0080.03712.71
5.3.270.0110.05012.72
5.3.260.0050.04512.71
5.3.250.0110.03412.72
5.3.240.0070.03712.71
5.3.230.0090.04512.71
5.3.220.0110.03612.68
5.3.210.0110.03612.68
5.3.200.0080.04112.68
5.3.190.0110.03212.68
5.3.180.0090.03812.67
5.3.170.0050.04112.67
5.3.160.0050.04112.67
5.3.150.0070.04512.67
5.3.140.0070.03712.66
5.3.130.0100.03612.66
5.3.120.0090.03812.66
5.3.110.0060.04212.65
5.3.100.0070.03612.13
5.3.90.0060.04112.11
5.3.80.0130.03612.10
5.3.70.0070.03912.10
5.3.60.0080.03712.08
5.3.50.0090.04212.03
5.3.40.0130.04012.03
5.3.30.0100.03611.99
5.3.20.0100.04211.77
5.3.10.0090.03911.74
5.3.00.0060.04111.73
5.2.170.0050.0349.22
5.2.160.0060.0319.23
5.2.150.0060.0409.22
5.2.140.0080.0289.22
5.2.130.0070.0329.18
5.2.120.0090.0349.18
5.2.110.0060.0289.20
5.2.100.0080.0329.19
5.2.90.0070.0339.19
5.2.80.0030.0319.19
5.2.70.0050.0379.18
5.2.60.0070.0279.13
5.2.50.0050.0299.10
5.2.40.0080.0259.09
5.2.30.0020.0329.05
5.2.20.0060.0289.05
5.2.10.0040.0348.96
5.2.00.0040.0338.82
5.1.60.0050.0268.10
5.1.50.0060.0298.10
5.1.40.0050.0238.07
5.1.30.0020.0278.43
5.1.20.0060.0248.45
5.1.10.0090.0288.18
5.1.00.0050.0368.18
5.0.50.0040.0216.65
5.0.40.0020.0246.52
5.0.30.0060.0376.32
5.0.20.0030.0226.29
5.0.10.0050.0216.27
5.0.00.0020.0416.27
4.4.90.0040.0184.78
4.4.80.0030.0154.76
4.4.70.0050.0134.75
4.4.60.0020.0154.75
4.4.50.0040.0134.77
4.4.40.0050.0274.70
4.4.30.0030.0164.75
4.4.20.0030.0164.84
4.4.10.0040.0254.85
4.4.00.0040.0294.76
4.3.110.0030.0154.67
4.3.100.0030.0154.67
4.3.90.0030.0144.63
4.3.80.0030.0244.58
4.3.70.0030.0144.63
4.3.60.0020.0154.63
4.3.50.0020.0164.63
4.3.40.0040.0234.54
4.3.30.0040.0193.30
4.3.20.0020.0203.28
4.3.10.0010.0163.24
4.3.00.0070.0206.74

preferences:
47.95 ms | 401 KiB | 5 Q