3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyError implements \JsonSerializable { private $name; private $code; private $msg; public function __construct($errorName, $errorCode, $errorMSG) { $this->name = $errorName; $this->code = $errorCode; $this->msg = $errorMSG; } public function jsonSerialize() { return get_object_vars($this); // or return [ 'name' => $this->name, 'code' => $this->code, 'msg' => $this->msg ]; } } $error = new MyError("Page not found", 404, "Unfortunately, the page does not exist"); echo json_encode($error);

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.4.10.0030.00619.86
8.3.140.0040.01420.55
8.3.130.0060.00318.46
8.3.120.0030.00518.79
8.3.110.0110.00720.94
8.3.100.0090.00016.75
8.3.90.0110.00426.77
8.3.80.0040.00716.73
8.3.70.0040.01116.63
8.3.60.0070.01118.68
8.3.50.0090.00922.83
8.3.40.0130.00619.38
8.3.30.0090.00918.82
8.3.20.0070.00721.07
8.3.10.0090.00621.80
8.3.00.0090.00619.23
8.2.250.0040.00416.68
8.2.240.0040.00417.51
8.2.230.0070.00322.58
8.2.220.0090.00037.54
8.2.210.0070.00326.77
8.2.200.0030.00618.42
8.2.190.0070.01416.58
8.2.180.0100.00725.92
8.2.170.0120.00521.05
8.2.160.0120.00719.69
8.2.150.0090.00720.68
8.2.140.0030.01122.54
8.2.130.0060.00823.25
8.2.120.0080.00819.93
8.2.110.0060.01020.99
8.2.100.0140.00718.31
8.2.90.0170.00518.11
8.2.80.0160.00518.66
8.2.70.0150.00517.94
8.2.60.0110.00617.98
8.2.50.0120.00718.21
8.2.40.0120.00518.81
8.2.30.0150.00518.54
8.2.20.0140.00618.08
8.2.10.0100.00918.22
8.2.00.0100.00518.18
8.1.300.0090.00017.76
8.1.290.0090.00030.84
8.1.280.0140.00025.92
8.1.270.0070.00523.12
8.1.260.0040.00724.21
8.1.250.0070.00525.14
8.1.240.0120.00020.27
8.1.230.0120.00419.43
8.1.220.0140.00518.13
8.1.210.0130.00618.35
8.1.200.0150.00417.99
8.1.190.0080.00917.87
8.1.180.0100.00718.09
8.1.170.0120.00818.04
8.1.160.0150.00118.41
8.1.150.0080.00818.31
8.1.140.0130.00418.69
8.1.130.0120.00718.03
8.1.120.0090.00918.07
8.1.110.0100.00818.10
8.1.100.0120.00518.33
8.1.90.0080.00617.83
8.1.80.0110.00518.37
8.1.70.0120.00317.95
8.1.60.0110.00517.90
8.1.50.0140.00417.82
8.1.40.0140.00318.05
8.1.30.0120.00618.17
8.1.20.0110.00418.31
8.1.10.0130.00518.01
8.1.00.0090.00817.95
8.0.300.0140.00618.49
8.0.290.0190.00517.36
8.0.280.0120.00917.91
8.0.270.0170.00417.51
8.0.260.0170.00417.59
8.0.250.0140.00517.64
8.0.240.0180.00417.60
8.0.230.0170.00317.63
8.0.220.0150.00617.56
8.0.210.0140.00817.50
8.0.200.0130.00517.45
8.0.190.0170.00217.48
8.0.180.0090.00717.27
8.0.170.0170.00317.42
8.0.160.0120.00517.47
8.0.150.0140.00417.41
8.0.140.0150.00617.33
8.0.130.0130.00516.66
8.0.120.0110.00717.39
8.0.110.0130.00317.34
8.0.100.0120.00417.30
8.0.90.0120.00517.38
8.0.80.0090.00917.23
8.0.70.0120.00517.36
8.0.60.0130.00717.30
8.0.50.0140.00517.29
8.0.30.0090.00817.24
8.0.20.0120.00617.40
8.0.10.0160.00217.43
8.0.00.0070.00917.64
7.4.330.0100.00316.12
7.4.320.0150.00617.40
7.4.300.0100.00416.87
7.4.290.0130.00317.03
7.4.280.0120.00817.20
7.4.270.0120.00716.96
7.4.260.0130.00517.07
7.4.250.0140.00517.08
7.4.240.0120.00316.95
7.4.230.0110.00316.89
7.4.220.0130.00517.01
7.4.210.0120.00517.21
7.4.200.0110.00617.35
7.4.190.0140.00417.41
7.4.180.0120.00517.47
7.4.160.0120.00517.28
7.4.150.0130.00417.38
7.4.140.0120.00517.42
7.4.130.0120.00617.08
7.4.120.0120.00617.19
7.4.110.0140.00517.05
7.4.100.0140.00517.11
7.4.90.0140.00417.07
7.4.80.0110.00617.44
7.4.70.0140.00517.08
7.4.60.0130.00517.10
7.4.50.0120.00617.00
7.4.40.0120.00717.11
7.4.30.0140.00517.13
7.4.20.0100.00916.93
7.4.10.0130.00516.93
7.4.00.0100.00616.62
7.3.330.0130.00516.30
7.3.320.0140.00516.26
7.3.310.0130.00616.87
7.3.300.0090.00716.85
7.3.290.0130.00616.61
7.3.280.0140.00516.64
7.3.270.0130.00416.94
7.3.260.0130.00616.70
7.3.250.0100.00816.63
7.3.240.0130.00516.68
7.3.230.0100.00816.69
7.3.220.0130.00516.73
7.3.210.0140.00416.62
7.3.200.0120.00616.62
7.3.190.0130.00616.66
7.3.180.0110.00816.65
7.3.170.0130.00616.76
7.3.160.0140.00516.63
7.3.150.0130.00616.73
7.3.140.0110.00716.66
7.3.130.0110.00716.62
7.3.120.0110.00716.23
7.3.110.0100.00816.28
7.3.100.0080.00916.14
7.3.90.0110.00716.09
7.3.80.0110.00616.06
7.3.70.0100.00816.13
7.3.60.0100.00716.05
7.3.50.0100.00715.85
7.3.40.0110.00615.78
7.3.30.0090.00815.68
7.3.20.0330.00716.32
7.3.10.0210.00716.32
7.3.00.0220.00816.21
7.2.340.0180.00416.72
7.2.330.0150.00716.77
7.2.320.0120.00916.84
7.2.310.0140.00716.79
7.2.300.0120.01016.82
7.2.290.0170.00516.82
7.2.280.0170.00616.88
7.2.270.0150.00716.80
7.2.260.0130.00816.75
7.2.250.0140.00716.56
7.2.240.0110.00916.48
7.2.230.0120.00816.40
7.2.220.0120.00716.29
7.2.210.0100.00916.28
7.2.200.0110.00816.34
7.2.190.0100.01016.30
7.2.180.0090.01016.13
7.2.170.0100.00916.04
7.2.160.0110.00716.05
7.2.150.0180.00916.62
7.2.140.0170.00816.61
7.2.130.0220.00816.58
7.2.120.0200.00816.49
7.2.110.0350.00716.27
7.2.100.0330.00716.26
7.2.90.0300.00916.27
7.2.80.0310.01116.29
7.2.70.0300.00616.27
7.2.60.0350.01016.33
7.2.50.0280.00816.36
7.2.40.0270.00916.35
7.2.30.0280.00616.35
7.2.20.0290.00716.30
7.2.10.0300.00816.34
7.2.00.0250.00716.31
7.1.330.0150.00616.23
7.1.320.0130.00715.88
7.1.310.0140.00715.90
7.1.300.0120.00815.84
7.1.290.0160.00715.84
7.1.280.0130.00615.63
7.1.270.0190.00815.57
7.1.260.0170.00815.52
7.1.250.0250.00815.40
7.1.240.0240.00715.39
7.1.230.0340.00615.18
7.1.220.0310.00815.15
7.1.210.0310.00815.15
7.1.200.0330.00615.15
7.1.190.0330.00815.16
7.1.180.0300.00615.33
7.1.170.0280.00815.15
7.1.160.0340.00715.20
7.1.150.0290.00815.14
7.1.140.0280.00715.16
7.1.130.0270.00715.17
7.1.120.0280.00815.17
7.1.110.0270.00715.20
7.1.100.0340.00815.18
7.1.90.0400.00615.12
7.1.80.0300.00915.19
7.1.70.0350.00715.13
7.1.60.0390.00717.73
7.1.50.0340.00917.75
7.1.40.0320.00817.69
7.1.30.0370.00817.70
7.1.20.0340.00717.72
7.1.10.0260.00915.13
7.1.00.0350.00815.10
7.0.330.0270.00715.05
7.0.320.0280.00715.07
7.0.310.0430.00814.83
7.0.300.0300.00714.81
7.0.290.0310.00714.84
7.0.280.0300.00914.86
7.0.270.0350.00714.87
7.0.260.0230.00814.82
7.0.250.0270.00814.79
7.0.240.0260.00814.88
7.0.230.0230.00814.89
7.0.220.0380.00714.88
7.0.210.0360.00614.86
7.0.200.0310.00814.84
7.0.190.0400.00714.86
7.0.180.0320.00814.85
7.0.170.0300.00714.88
7.0.160.0220.00914.85
7.0.150.0310.00714.83
7.0.140.0280.00814.87
7.0.130.0300.00614.88
7.0.120.0300.00714.83
7.0.110.0250.00614.90
7.0.100.0250.00714.82
7.0.90.0300.00714.82
7.0.80.0340.00614.74
7.0.70.0270.00714.74
7.0.60.0280.00814.79
7.0.50.0250.00714.82
7.0.40.0300.00714.82
7.0.30.0300.00614.78
7.0.20.0290.00714.75
7.0.10.0280.00714.79
7.0.00.0260.00714.72
5.6.400.0140.00815.48
5.6.390.0150.00815.53
5.6.380.0130.00915.22
5.6.370.0140.00815.33
5.6.360.0140.00815.26
5.6.350.0140.00815.25
5.6.340.0130.00915.26
5.6.330.0110.00915.27
5.6.320.0140.00815.24
5.6.310.0140.00815.29
5.6.300.0150.00815.20
5.6.290.0140.00815.23
5.6.280.0130.00815.25
5.6.270.0150.00815.25
5.6.260.0150.00715.26
5.6.250.0120.00915.29
5.6.240.0140.00715.24
5.6.230.0130.00915.18
5.6.220.0140.00715.22
5.6.210.0140.00715.17
5.6.200.0120.01015.24
5.6.190.0160.00615.26
5.6.180.0150.00715.22
5.6.170.0130.00815.24
5.6.160.0130.00815.20
5.6.150.0130.00915.19
5.6.140.0150.00715.24
5.6.130.0140.00815.16
5.6.120.0150.00915.19
5.6.110.0150.00815.23
5.6.100.0140.00715.17
5.6.90.0140.00915.14
5.6.80.0140.00715.13
5.6.70.0130.00915.11
5.6.60.0130.00915.14
5.6.50.0150.00615.12
5.6.40.0120.00815.14
5.6.30.0150.00715.11
5.6.20.0130.00915.08
5.6.10.0150.00715.16
5.6.00.0120.01015.12
5.5.380.0140.00914.67
5.5.370.0120.00814.49
5.5.360.0120.00714.42
5.5.350.0140.00614.41
5.5.340.0130.00714.45
5.5.330.0140.00614.51
5.5.320.0130.00814.45
5.5.310.0140.00914.45
5.5.300.0120.00814.47
5.5.290.0140.00914.46
5.5.280.0130.00914.38
5.5.270.0140.00914.47
5.5.260.0140.00814.45
5.5.250.0130.00814.41
5.5.240.0130.00814.40
5.5.230.0130.00814.37
5.5.220.0140.00814.41
5.5.210.0140.00714.41
5.5.200.0140.00814.34
5.5.190.0150.00614.43
5.5.180.0130.00714.37
5.5.170.0140.00814.91
5.5.160.0130.00814.35
5.5.150.0130.00714.31
5.5.140.0140.00814.35
5.5.130.0120.00914.35
5.5.120.0110.00914.33
5.5.110.0130.00914.34
5.5.100.0120.00714.44
5.5.90.0130.00814.39
5.5.80.0130.00714.37
5.5.70.0140.00814.47
5.5.60.0130.00714.41
5.5.50.0130.00714.40
5.5.40.0120.00714.35
5.5.30.0120.00714.37
5.5.20.0120.00714.39
5.5.10.0140.00714.37
5.5.00.0130.00714.36

preferences:
44.21 ms | 403 KiB | 5 Q