3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dataFormat = array( "dateTimeOfData" => "DateTime", "open" => "double", "high" => "double", "low" => "double", "close" => "double", "volume" => "integer", "isCritical" => "boolean"//Temporary ); function validateFormat($data){ global $dataFormat; //Check that all the required fields exist $missing = array_diff_key($dataFormat, $data); $extra = array_diff_key($data, $dataFormat); if(!empty($missing) || !empty($extra)){ throw new InvalidArgumentException("Incorrect data format provided"); } //Check that all the data is of the correct type foreach($data as $k => $v){ $type = gettype($v) === "object" ? get_class($v) : gettype($v); $correctType = $dataFormat[$k]; if($type !== $correctType){ throw new InvalidArgumentException("Data is of an incorrect type."); } } } $arr = array("dateTimeOfData" => new DateTime(), //"open" => 10.1, "high" => 10.1, "low" => 10.1, "close" => 10.1, "volume" => 10, "isCritical" => true); validateFormat($arr);

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.01118.56
8.3.50.0100.00821.13
8.3.40.0060.00919.14
8.3.30.0090.00619.04
8.3.20.0090.00620.16
8.3.10.0030.00523.66
8.3.00.0040.00422.31
8.2.180.0070.01116.75
8.2.170.0000.01522.96
8.2.160.0080.00620.38
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0090.00017.88
8.2.110.0050.00520.59
8.2.100.0060.00618.00
8.2.90.0040.00419.36
8.2.80.0030.00617.97
8.2.70.0060.00317.75
8.2.60.0040.00418.05
8.2.50.0000.00818.07
8.2.40.0040.00421.10
8.2.30.0070.00019.85
8.2.20.0000.00718.02
8.2.10.0040.00418.09
8.2.00.0050.00318.21
8.1.280.0100.00325.92
8.1.270.0060.00320.38
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0040.00423.84
8.1.230.0090.00317.61
8.1.220.0030.00517.74
8.1.210.0030.00618.77
8.1.200.0060.00317.60
8.1.190.0000.00817.60
8.1.180.0050.00318.10
8.1.170.0090.00018.74
8.1.160.0060.00322.04
8.1.150.0030.00719.05
8.1.140.0030.00617.74
8.1.130.0030.00317.71
8.1.120.0030.00417.76
8.1.110.0040.00417.63
8.1.100.0000.00817.66
8.1.90.0000.00717.67
8.1.80.0070.00017.69
8.1.70.0030.00317.72
8.1.60.0000.00817.75
8.1.50.0040.00417.57
8.1.40.0000.00917.66
8.1.30.0080.00017.77
8.1.20.0000.00817.78
8.1.10.0060.00317.71
8.1.00.0000.00817.75
8.0.300.0040.00418.77
8.0.290.0000.00717.13
8.0.280.0040.00418.46
8.0.270.0040.00417.35
8.0.260.0000.00617.40
8.0.250.0040.00417.13
8.0.240.0080.00017.29
8.0.230.0030.00317.19
8.0.220.0030.00317.05
8.0.210.0000.00817.16
8.0.200.0030.00317.27
8.0.190.0000.00817.25
8.0.180.0000.00817.10
8.0.170.0040.00417.05
8.0.160.0040.00417.18
8.0.150.0090.00017.10
8.0.140.0040.00417.17
8.0.130.0050.00313.57
8.0.120.0050.00317.16
8.0.110.0040.00417.22
8.0.100.0030.00517.18
8.0.90.0050.00317.07
8.0.80.0060.00917.18
8.0.70.0000.00717.18
8.0.60.0000.00717.10
8.0.50.0050.00217.02
8.0.30.0150.00417.34
8.0.20.0080.01217.44
8.0.10.0050.00317.33
8.0.00.0080.01017.04
7.4.330.0050.00015.08
7.4.320.0040.00416.67
7.4.300.0060.00016.74
7.4.290.0040.00416.77
7.4.280.0040.00416.67
7.4.270.0030.00416.69
7.4.260.0000.00716.68
7.4.250.0050.00216.73
7.4.240.0010.00616.71
7.4.230.0070.00016.79
7.4.220.0100.00716.71
7.4.210.0140.00016.71
7.4.200.0000.00716.65
7.4.160.0170.00016.59
7.4.150.0120.00617.40
7.4.140.0120.00817.86
7.4.130.0110.00716.74
7.4.120.0070.01316.84
7.4.110.0100.00716.75
7.4.100.0090.00916.76
7.4.90.0090.00916.58
7.4.80.0170.00319.39
7.4.70.0090.00916.67
7.4.60.0170.00016.81
7.4.50.0040.00416.70
7.4.40.0070.01116.87
7.4.30.0110.01116.73
7.4.00.0040.01115.30
7.3.330.0030.00313.32
7.3.320.0000.00513.33
7.3.310.0070.00016.49
7.3.300.0070.00016.35
7.3.290.0090.00716.42
7.3.280.0100.01016.48
7.3.270.0100.00717.40
7.3.260.0120.00416.64
7.3.250.0060.01116.52
7.3.240.0130.00516.87
7.3.230.0170.00616.74
7.3.210.0030.01316.53
7.3.200.0070.01019.39
7.3.190.0100.00716.50
7.3.180.0000.01616.59
7.3.170.0100.00716.62
7.3.160.0090.00916.63
7.2.330.0110.00716.96
7.2.320.0100.00716.83
7.2.310.0130.01016.63
7.2.300.0140.00716.61
7.2.290.0100.01016.63
7.2.60.0160.00017.07
7.2.00.0040.00719.40
7.1.200.0000.00915.57
7.1.100.0100.00318.51
7.1.70.0040.00417.41
7.1.60.0130.01020.03
7.1.50.0120.00317.24
7.1.00.0100.06722.45
7.0.200.0080.00414.97
7.0.60.0030.04319.97
7.0.50.0070.07017.88
7.0.40.0070.08720.15
7.0.30.0300.07720.08
7.0.20.0200.04720.19
7.0.10.0070.04020.22
7.0.00.0000.09320.07
5.6.210.0000.08020.50
5.6.200.0100.08018.18
5.6.190.0000.09320.58
5.6.180.0200.07720.34
5.6.170.0370.05720.50
5.6.160.0130.07720.50
5.6.150.0100.03318.21
5.6.140.0170.06018.23
5.6.130.0070.05018.18
5.6.120.0100.04021.08
5.6.110.0100.07321.12
5.6.100.0230.07721.03
5.6.90.0070.04320.96
5.6.80.0100.07320.41
5.5.350.0230.08320.38
5.5.340.0070.03717.99
5.5.330.0030.08320.57
5.5.320.0230.03720.36
5.5.310.0430.06720.24
5.5.300.0030.04318.07
5.5.290.0070.06717.99
5.5.280.0170.07320.91
5.5.270.0030.07720.88
5.5.260.0130.04320.98
5.5.250.0130.07320.55
5.5.240.3630.04020.36
5.4.450.0300.04019.61
5.4.440.0270.05019.39
5.4.430.0170.05719.44
5.4.420.0130.07319.18
5.4.410.0230.05319.48
5.4.400.0200.05319.30
5.4.390.0170.05319.06
5.4.380.0200.04719.16
5.4.370.0170.05019.26
5.4.360.0200.05018.87
5.4.350.0230.04319.14
5.4.340.0170.05319.37
5.4.320.0300.04018.87
5.4.310.0270.04318.87
5.4.300.0230.04719.37
5.4.290.0230.04719.14
5.4.280.0100.06018.96
5.4.270.0200.05018.83
5.4.260.0130.05018.86
5.4.250.0100.05719.13
5.4.240.0170.05019.14
5.4.230.0130.05319.14
5.4.220.0070.06319.25
5.4.210.0270.04319.13
5.4.200.0130.05016.73
5.4.190.0170.05719.32
5.4.180.0100.06018.97
5.4.170.0230.05018.93
5.4.160.0130.05319.11
5.4.150.0170.05719.17
5.4.140.0130.05316.46
5.4.130.0300.03316.45
5.4.120.0270.04016.56
5.4.110.0170.06716.39
5.4.100.0270.05016.75
5.4.90.0200.04716.55
5.4.80.0200.04716.53
5.4.70.0170.05016.58
5.4.60.0100.05316.56
5.4.50.0000.07316.53
5.4.40.0270.02716.54
5.4.30.0300.07016.42
5.4.20.0370.05716.34

preferences:
79.13 ms | 401 KiB | 5 Q