3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Products{ protected $_title; protected $_category; protected $_price; public function __construct($title, $category, $price){ if($price < 0){ throw new Exception('Price must be a positive number'); } $this->_title = $title; $this->_category = $category; $this->_price = $price; } public function getPrice(){ return $this->_price; } } try{ $product = new Products('Title', 'Category', -45); echo $product->getPrice(); } catch(Exception $e){ echo 'Caught exception: ', $e->getMessage(), "\n"; echo 'Caught exception: ', $e->getCode(), "\n"; echo 'Caught exception: ', $e->getFile(), "\n"; echo 'Caught exception: ', $e->getLine(), "\n"; echo 'Caught exception: ', $e->getTrace(), "\n"; echo 'Caught exception: ', $e->getTraceAsString(), "\n"; echo 'Caught exception: ', $e, "\n"; }

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.40.0120.00318.96
8.3.30.0070.00719.09
8.3.20.0050.00320.26
8.3.10.0030.00522.09
8.3.00.0040.00422.32
8.2.170.0110.00722.96
8.2.160.0110.00419.33
8.2.150.0050.00324.18
8.2.140.0060.00324.66
8.2.130.0150.00326.16
8.2.120.0040.00417.63
8.2.110.0090.01522.32
8.2.100.0080.00319.64
8.2.90.0020.00519.13
8.2.80.0030.00619.77
8.2.70.0090.00017.63
8.2.60.0030.00717.93
8.2.50.0030.00618.07
8.2.40.0000.00818.34
8.2.30.0070.00318.10
8.2.20.0040.00417.61
8.2.10.0000.00819.45
8.2.00.0040.00417.67
8.1.270.0080.00022.14
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0030.00623.63
8.1.230.0040.00719.07
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0080.00017.48
8.1.190.0070.00017.41
8.1.180.0030.00618.10
8.1.170.0110.00018.46
8.1.160.0050.00522.07
8.1.150.0050.00318.66
8.1.140.0030.00517.37
8.1.130.0020.00517.80
8.1.120.0000.00717.52
8.1.110.0040.00417.29
8.1.100.0040.00417.45
8.1.90.0070.00017.49
8.1.80.0040.00417.51
8.1.70.0070.00017.43
8.1.60.0050.00617.63
8.1.50.0000.00817.45
8.1.40.0000.00817.41
8.1.30.0070.00017.66
8.1.20.0000.00817.56
8.1.10.0070.00017.59
8.1.00.0050.00217.36
8.0.300.0000.00718.77
8.0.290.0070.00017.16
8.0.280.0030.00318.45
8.0.270.0030.00317.27
8.0.260.0070.00016.88
8.0.250.0000.00816.98
8.0.240.0030.00316.97
8.0.230.0040.00416.99
8.0.220.0000.00716.81
8.0.210.0040.00416.80
8.0.200.0060.00016.93
8.0.190.0040.00416.87
8.0.180.0020.00516.91
8.0.170.0000.00816.86
8.0.160.0070.00016.82
8.0.150.0030.00316.85
8.0.140.0040.00416.97
8.0.130.0030.00313.37
8.0.120.0070.00016.86
8.0.110.0000.00716.93
8.0.100.0040.00416.83
8.0.90.0040.00416.92
8.0.80.0090.00616.89
8.0.70.0000.00816.84
8.0.60.0080.00016.84
8.0.50.0040.00416.86
8.0.30.0120.01417.16
8.0.20.0170.00517.40
8.0.10.0040.00417.05
8.0.00.0120.00816.88
7.4.330.0050.00015.00
7.4.320.0020.00516.59
7.4.300.0000.00716.63
7.4.290.0030.00316.49
7.4.280.0040.00416.64
7.4.270.0030.00316.46
7.4.260.0070.00016.40
7.4.250.0040.00416.54
7.4.240.0020.00616.50
7.4.230.0030.00316.52
7.4.220.0200.00716.64
7.4.210.0050.01316.56
7.4.200.0030.00316.71
7.4.190.0000.00816.70
7.4.160.0120.00316.48
7.4.150.0100.00717.40
7.4.140.0060.01217.86
7.4.130.0160.00516.53
7.4.120.0110.00616.43
7.4.110.0090.00916.67
7.4.100.0060.01316.49
7.4.90.0070.01116.64
7.4.80.0150.00919.39
7.4.70.0050.01116.52
7.4.60.0030.01316.54
7.4.50.0050.00516.53
7.4.40.0040.01122.77
7.4.30.0080.00816.63
7.4.10.0040.01516.39
7.4.00.0020.01015.60
7.3.330.0000.00513.16
7.3.320.0030.00313.38
7.3.310.0000.00716.48
7.3.300.0070.00016.34
7.3.290.0140.00716.35
7.3.280.0060.01316.35
7.3.270.0140.00317.40
7.3.260.0130.00516.62
7.3.250.0150.00316.36
7.3.240.0100.00716.65
7.3.230.0140.00316.39
7.3.210.0120.00616.51
7.3.200.0040.01419.39
7.3.190.0110.00616.56
7.3.180.0090.00616.35
7.3.170.0080.00916.54
7.3.160.0080.00816.67
7.3.130.0060.01316.41
7.3.120.0080.00915.69
7.3.110.0030.01216.33
7.3.100.0060.00616.20
7.3.90.0060.00616.45
7.3.80.0090.00616.66
7.3.70.0000.00916.54
7.3.60.0060.00916.32
7.3.50.0000.01516.49
7.3.40.0100.00616.45
7.3.30.0040.01116.41
7.3.20.0060.00918.20
7.3.10.0080.00517.26
7.3.00.0050.00617.31
7.2.330.0090.01216.83
7.2.320.0120.00616.81
7.2.310.0040.01316.38
7.2.300.0060.01216.57
7.2.290.0060.01316.48
7.2.260.0090.01216.48
7.2.250.0070.01316.73
7.2.240.0060.00916.82
7.2.230.0060.00916.38
7.2.220.0060.00616.79
7.2.210.0070.01116.59
7.2.200.0090.00616.47
7.2.190.0000.01716.52
7.2.180.0000.01416.56
7.2.170.0000.00916.59
7.2.160.0030.01316.75
7.2.150.0070.00418.38
7.2.140.0060.01018.29
7.2.130.0060.00817.46
7.2.120.0000.01417.51
7.2.110.0060.00817.71
7.2.100.0060.00917.64
7.2.90.0070.00917.69
7.2.80.0040.00717.45
7.2.70.0050.00717.68
7.2.60.0070.00717.39
7.2.50.0120.00517.32
7.2.40.0040.00917.70
7.2.30.0060.00817.72
7.2.20.0090.01117.64
7.2.10.0050.00917.73
7.2.00.0040.01018.16
7.1.330.0090.00617.31
7.1.320.0060.00317.31
7.1.310.0040.00817.20
7.1.300.0130.00017.40
7.1.290.0000.00917.48
7.1.280.0060.00317.28
7.1.270.0040.00717.48
7.1.260.0070.01117.29
7.1.250.0050.00516.45
7.1.240.0060.00617.30
7.1.230.0060.01317.32
7.1.220.0110.00017.26
7.1.210.0030.01017.22
7.1.200.0070.00516.56
7.1.190.0030.01017.23
7.1.180.0150.00017.29
7.1.170.0070.00417.29
7.1.160.0060.00917.41
7.1.150.0110.00317.27
7.1.140.0030.01417.34
7.1.130.0100.01017.41
7.1.120.0030.01417.27
7.1.110.0070.00717.46
7.1.100.0080.00717.66
7.1.90.0110.00417.02
7.1.80.0090.00616.97
7.1.70.0060.00617.21
7.1.60.0050.01618.51
7.1.50.0070.00717.13
7.1.40.0040.01117.36
7.1.30.0070.01017.27
7.1.20.0030.01317.44
7.1.10.0040.01417.35
7.1.00.0030.04419.75
7.0.330.0060.00317.04
7.0.320.0070.00716.93
7.0.310.0060.00617.08
7.0.300.0060.00916.93
7.0.290.0000.01416.92
7.0.280.0040.01117.05
7.0.270.0070.01116.91
7.0.260.0110.00417.03
7.0.250.0070.00717.10
7.0.240.0060.00916.94
7.0.230.0000.01517.04
7.0.220.0080.01217.01
7.0.210.0200.00817.00
7.0.200.0160.00616.84
7.0.190.0140.01117.03
7.0.180.0170.00717.02
7.0.170.0050.01617.07
7.0.160.0240.00416.98
7.0.150.0220.00716.98
7.0.140.0070.04719.51
7.0.130.0120.01217.09
7.0.120.0170.00816.99
7.0.110.0080.02317.12
7.0.100.0140.01416.99
7.0.90.0090.01716.98
7.0.80.0160.01316.94
7.0.70.0110.01516.98
7.0.60.0180.04418.46
7.0.50.0100.02717.45
7.0.40.0110.04817.67
7.0.30.0150.02717.59
7.0.20.0130.02217.55
7.0.10.0080.04217.64
7.0.00.0100.02717.53
5.6.400.0040.01115.82
5.6.390.0060.00915.68
5.6.380.0070.01015.96
5.6.370.0100.00016.17
5.6.360.0120.00315.59
5.6.350.0090.00616.14
5.6.340.0090.00315.75
5.6.330.0130.00615.89
5.6.320.0070.01016.08
5.6.310.0210.00716.07
5.6.300.0170.01315.98
5.6.290.0170.00615.95
5.6.280.0130.04018.53
5.6.270.0100.01715.89
5.6.260.0200.01216.22
5.6.250.0220.00615.96
5.6.240.0110.01415.79
5.6.230.0180.01115.82
5.6.220.0110.01715.86
5.6.210.0120.04118.46
5.6.200.0130.04516.98
5.6.190.0140.04618.00
5.6.180.0290.03918.37
5.6.170.0270.02418.20
5.6.160.0180.04218.22
5.6.150.0130.03217.02
5.6.140.0100.04016.99
5.6.130.0090.02617.05
5.6.120.0140.04418.47
5.6.110.0130.04818.43
5.6.100.0110.02318.45
5.6.90.0100.03218.30
5.6.80.0040.04018.06
5.6.70.2280.02618.06
5.6.60.0040.01115.70
5.6.50.0060.00615.86
5.6.40.0060.00615.68
5.6.30.0100.00015.70
5.6.20.0090.00615.90
5.6.10.0030.00915.71
5.6.00.0070.00715.68
5.5.380.0170.01015.96
5.5.370.0190.01115.82
5.5.360.0150.01015.95
5.5.350.0130.02818.03
5.5.340.0090.02416.81
5.5.330.0090.03118.03
5.5.320.0110.03017.91
5.5.310.0220.04117.95
5.5.300.0100.03316.97
5.5.290.0090.02516.92
5.5.280.0090.03018.23
5.5.270.0060.04518.27
5.5.260.0090.03118.42
5.5.250.0070.04818.20
5.5.240.0030.01918.01
5.5.230.0100.00615.64
5.5.220.0040.01115.64
5.5.210.0030.01015.74
5.5.200.0070.00715.67
5.5.190.0070.00715.93
5.5.180.0060.01015.61
5.5.170.0030.01115.54
5.5.160.0040.01115.84
5.5.150.0090.00615.77
5.5.140.0080.00815.72
5.5.130.0030.00915.60
5.5.120.0070.00715.92
5.5.110.0070.00715.64
5.5.100.0070.00315.64
5.5.90.0040.01415.79
5.5.80.0080.00315.73
5.5.70.0100.00615.73
5.5.60.0040.00815.79
5.5.50.0090.00315.75
5.5.40.0100.00715.71
5.5.30.0040.00715.78
5.5.20.0090.00315.85
5.5.10.0030.00715.88
5.5.00.0100.00315.77
5.4.450.0360.03016.06
5.4.440.0200.02316.00
5.4.430.0110.03416.17
5.4.420.0120.03216.00
5.4.410.0130.02316.15
5.4.400.0050.03215.65
5.4.390.0030.03315.53
5.4.380.0180.03115.64
5.4.370.0130.03015.65
5.4.360.0100.03115.67
5.4.350.0090.03215.67
5.4.340.0100.03615.79
5.4.330.0060.00312.56
5.4.320.0060.02312.55
5.4.310.0070.02412.62
5.4.300.0030.02412.56
5.4.290.0040.02312.56
5.4.280.0080.02012.61
5.4.270.0100.03015.98
5.4.260.0100.02615.76
5.4.250.0020.04615.84
5.4.240.0080.03015.74
5.4.230.0130.03015.83
5.4.220.0100.04015.75
5.4.210.0050.03215.75
5.4.200.0020.03715.80
5.4.190.0100.03015.76
5.4.180.0070.02915.99
5.4.170.0070.03415.75
5.4.160.0050.03715.82
5.4.150.0100.03215.73
5.4.140.0060.03914.58
5.4.130.0080.03314.58
5.4.120.0030.03514.46
5.4.110.0070.03214.68
5.4.100.0070.03014.54
5.4.90.0050.03014.51
5.4.80.0060.03414.61
5.4.70.0150.03514.56
5.4.60.0160.02314.62
5.4.50.0110.02814.65
5.4.40.0080.03514.72
5.4.30.0080.03714.66
5.4.20.0120.02514.64
5.4.10.0150.02814.56
5.4.00.0150.03514.36
5.3.290.0100.02512.92
5.3.280.0100.03814.04
5.3.270.0070.04413.94
5.3.260.0070.03613.93
5.3.250.0120.02713.94
5.3.240.0100.03113.86
5.3.230.0080.04113.97
5.3.220.0090.03613.92
5.3.210.0130.02713.77
5.3.200.0080.03313.80
5.3.190.0110.03313.85
5.3.180.0080.03213.90
5.3.170.0060.03213.87
5.3.160.0190.03213.96
5.3.150.0090.03513.90
5.3.140.0130.03413.87
5.3.130.0150.03313.91
5.3.120.0090.03613.81
5.3.110.0120.03413.82
5.3.100.0120.03913.65
5.3.90.0090.02913.65
5.3.80.0140.03313.56
5.3.70.0090.03213.54
5.3.60.0080.03013.46
5.3.50.0100.02913.42
5.3.40.0120.02713.64
5.3.30.0120.04013.41
5.3.20.0120.02513.51
5.3.10.0120.02913.30
5.3.00.0130.02513.42
5.2.170.0130.05011.20
5.2.160.0030.04311.03
5.2.150.0130.03711.45
5.2.140.0100.04011.46
5.2.130.0030.05010.99
5.2.120.0070.04711.37
5.2.110.0070.05711.11
5.2.100.0070.04011.30
5.2.90.0070.04311.23
5.2.80.0030.04711.36
5.2.70.0100.06311.30
5.2.60.0130.04011.11
5.2.50.0130.03711.29
5.2.40.0100.05311.27
5.2.30.0070.06011.09
5.2.20.0070.03710.82
5.2.10.0170.02711.08
5.2.00.0070.04011.00
5.1.60.0100.03310.19
5.1.50.0030.04310.29
5.1.40.0100.04310.14
5.1.30.0100.04710.62
5.1.20.0200.03710.66
5.1.10.0030.04710.17
5.1.00.0070.05310.29
5.0.50.0130.0338.94
5.0.40.0030.0438.94
5.0.30.0100.0378.94
5.0.20.0070.0278.94
5.0.10.0070.0338.94
5.0.00.0000.0478.94
4.4.90.0000.0308.94
4.4.80.0030.0278.94
4.4.70.0100.0238.94
4.4.60.0030.0308.94
4.4.50.0000.0338.94
4.4.40.0030.0478.94
4.4.30.0170.0108.94
4.4.20.0000.0238.94
4.4.10.0130.0208.94
4.4.00.0030.0378.94
4.3.110.0070.0208.94
4.3.100.0030.0338.94
4.3.90.0000.0238.94
4.3.80.0070.0408.94
4.3.70.0000.0238.94
4.3.60.0030.0238.94
4.3.50.0000.0278.94
4.3.40.0000.0378.94
4.3.30.0070.0238.94
4.3.20.0030.0278.94
4.3.10.0000.0238.94
4.3.00.0100.0306.47

preferences:
31.02 ms | 400 KiB | 5 Q