3v4l.org

run code in 300+ PHP versions simultaneously
<?php class InvalidArgumentType extends InvalidArgumentException { public function __construct(int $position, string $requiredType, $value) { $encoded = json_encode($value); if (strlen($encoded) > 10) { $encoded = sprintf('%s ... %s', substr($encoded, 0, 10), substr($encoded, -1)); } $inferredType = is_object($value) ? get_class($value) : gettype($value); parent::__construct(sprintf( 'Argument %d value %s should be %s but is %s.', $position, $encoded, $requiredType, $inferredType )); } } class Foo {} echo (new InvalidArgumentType(1, 'string', new Foo()))->getMessage().PHP_EOL; echo (new InvalidArgumentType(2, 'string', [1,2,3,4,5,6,7,8,9,10]))->getMessage().PHP_EOL; echo (new InvalidArgumentType(3, 'string', 123))->getMessage().PHP_EOL; echo (new InvalidArgumentType(2, 'string', null))->getMessage();

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.0130.00416.72
8.5.00.0120.01420.05
8.4.150.0020.00014.05
8.4.140.0130.01017.68
8.4.130.0130.00717.76
8.4.120.0080.00119.66
8.4.110.0100.00623.82
8.4.100.0080.01217.63
8.4.90.0100.01120.48
8.4.80.0140.00817.93
8.4.70.0100.00917.91
8.4.60.0130.00720.73
8.4.50.0120.01022.65
8.4.40.0130.00717.60
8.4.30.0140.00718.68
8.4.20.0100.01019.50
8.4.10.0030.00619.32
8.3.280.0110.00918.44
8.3.270.0140.01116.52
8.3.260.0120.00716.46
8.3.250.0130.00619.07
8.3.240.0070.00316.66
8.3.230.0090.01016.83
8.3.220.0060.00219.03
8.3.210.0120.00918.54
8.3.200.0110.00916.64
8.3.190.0080.00817.16
8.3.180.0070.00218.36
8.3.170.0130.00617.30
8.3.160.0120.00616.63
8.3.150.0130.00616.64
8.3.140.0080.00016.85
8.3.130.0120.00418.39
8.3.120.0150.00620.83
8.3.110.0080.00016.63
8.3.100.0090.00016.53
8.3.90.0000.00726.77
8.3.80.0100.00018.32
8.3.70.0180.00016.58
8.3.60.0090.01216.63
8.3.50.0120.00523.74
8.3.40.0070.01118.88
8.3.30.0070.00718.79
8.3.20.0030.00524.18
8.3.10.0040.00424.66
8.3.00.0090.00026.16
8.2.290.0090.01216.43
8.2.280.0110.00718.46
8.2.270.0110.00718.52
8.2.260.0060.01317.05
8.2.250.0080.00016.70
8.2.240.0060.00918.72
8.2.230.0000.00820.94
8.2.220.0080.00037.54
8.2.210.0000.00926.77
8.2.200.0050.00516.75
8.2.190.0140.00718.54
8.2.180.0100.01025.92
8.2.170.0090.00619.04
8.2.160.0070.00722.96
8.2.150.0020.00525.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00019.24
8.2.110.0000.00820.51
8.2.100.0060.00617.91
8.2.90.0060.00317.84
8.2.80.0030.00618.05
8.2.70.0030.00617.80
8.2.60.0040.00418.22
8.2.50.0040.00418.10
8.2.40.0030.00619.34
8.2.30.0050.00319.30
8.2.20.0070.00018.02
8.2.10.0070.00019.36
8.2.00.0050.00319.40
8.1.330.0110.01016.45
8.1.320.0100.01016.34
8.1.310.0070.00718.34
8.1.300.0040.00416.35
8.1.290.0030.00630.84
8.1.280.0040.01125.92
8.1.270.0050.00323.99
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0100.00417.25
8.1.230.0070.00420.85
8.1.220.0080.00017.74
8.1.210.0000.00818.78
8.1.200.0060.00317.35
8.1.190.0040.00417.22
8.1.180.0030.00518.10
8.1.170.0030.00618.64
8.1.160.0030.00719.12
8.1.150.0060.00318.80
8.1.140.0040.00418.92
8.1.130.0000.00720.06
8.1.120.0040.00417.46
8.1.110.0040.00417.51
8.1.100.0040.00417.47
8.1.90.0030.00617.50
8.1.80.0000.00717.47
8.1.70.0030.00317.39
8.1.60.0030.00517.50
8.1.50.0040.00417.55
8.1.40.0000.00817.58
8.1.30.0040.00417.72
8.1.20.0090.00017.64
8.1.10.0030.00617.61
8.1.00.0100.00017.55
8.0.300.0040.00420.23
8.0.290.0040.00416.88
8.0.280.0070.00018.51
8.0.270.0040.00416.80
8.0.260.0030.00320.16
8.0.250.0000.00717.01
8.0.240.0030.00317.05
8.0.230.0040.00416.98
8.0.220.0000.00716.93
8.0.210.0040.00416.81
8.0.200.0030.00316.98
8.0.190.0000.00816.98
8.0.180.0030.00616.88
8.0.170.0000.00816.97
8.0.160.0040.00416.98
8.0.150.0000.00716.83
8.0.140.0000.00716.77
8.0.130.0030.00313.40
8.0.120.0000.00716.92
8.0.110.0030.00516.87
8.0.100.0000.00716.82
8.0.90.0040.00416.86
8.0.80.0040.01416.92
8.0.70.0040.00416.75
8.0.60.0040.00416.82
8.0.50.0050.00216.77
8.0.30.0130.00317.41
8.0.20.0120.00617.27
8.0.10.0040.00416.94
8.0.00.0150.00716.67
7.4.330.0000.00415.55
7.4.320.0030.00316.56
7.4.300.0040.00416.65
7.4.290.0000.00816.54
7.4.280.0040.00416.45
7.4.270.0000.00716.59
7.4.260.0030.00313.34
7.4.250.0000.00716.61
7.4.240.0030.00316.64
7.4.230.0080.00016.47
7.4.220.0020.00516.51
7.4.210.0040.01016.58
7.4.200.0040.00416.73
7.4.130.0070.00916.64
7.4.120.0070.01016.51
7.4.110.0110.01116.48
7.4.100.0030.01416.41
7.4.90.0140.00316.53
7.4.80.0070.01116.61
7.4.70.0080.01416.50
7.4.60.0030.01616.65
7.4.50.0140.00316.23
7.4.40.0060.01016.39
7.4.30.0080.00916.54
7.4.20.0130.00616.61
7.4.10.0170.00316.57
7.4.00.0100.00716.60
7.3.330.0030.00316.45
7.3.320.0030.00313.20
7.3.310.0030.00316.43
7.3.300.0030.00316.42
7.3.290.0090.00916.41
7.3.280.0070.01416.42
7.3.260.0100.00716.66
7.3.230.0130.00316.45
7.3.210.0150.00316.59
7.3.200.0140.00316.37
7.3.190.0030.01316.60
7.3.180.0100.00716.34
7.3.170.0110.00416.50
7.3.160.0000.01616.54
7.3.150.0120.00916.43
7.3.140.0100.00716.68
7.3.130.0030.01216.57
7.3.120.0130.00316.42
7.3.110.0140.00416.32
7.3.100.0100.01016.66
7.3.90.0040.01216.32
7.3.80.0060.00916.42
7.3.70.0060.00916.33
7.3.60.0100.00716.53
7.3.50.0080.00816.52
7.3.40.0030.01816.46
7.3.30.0100.00716.44
7.3.20.0120.00616.68
7.3.10.0120.01216.29
7.3.00.0140.01116.34
7.2.330.0120.00616.81
7.2.320.0100.00616.69
7.2.310.0030.01316.57
7.2.300.0070.01016.66
7.2.290.0100.01316.66
7.2.280.0070.01516.68
7.2.270.0130.01016.75
7.2.260.0060.01016.57
7.2.250.0040.01416.57
7.2.240.0030.01716.88
7.2.230.0130.00716.77
7.2.220.0110.00616.78
7.2.210.0070.01016.84
7.2.200.0100.00716.54
7.2.190.0030.01216.82
7.2.180.0070.01016.64
7.2.170.0130.00816.48
7.2.160.0120.00616.66
7.2.150.0070.01316.65
7.2.140.0170.00316.69
7.2.130.0160.00616.74
7.2.120.0170.00616.71
7.2.110.0060.01616.59
7.2.100.0070.01416.77
7.2.90.0070.01416.75
7.2.80.0040.01516.68
7.2.70.0100.01616.61
7.2.60.0060.01216.75
7.2.50.0150.00616.54
7.2.40.0130.01016.67
7.2.30.0090.00916.75
7.2.20.0040.01516.71
7.2.10.0140.00316.55
7.2.00.0120.01016.56

preferences:
152.47 ms | 403 KiB | 5 Q