3v4l.org

run code in 300+ PHP versions simultaneously
<?php function validateFormat($data){ //Check that all the required fields exist $missing = array_diff_key(self::$dataFormat, $data); $extra = array_diff_key($data, self::$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 = self::$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)
5.6.130.0300.04318.16
5.6.120.0100.07721.05
5.6.110.0100.08321.02
5.6.100.0000.09721.03
5.6.90.0100.08321.00
5.6.80.0070.05720.38
5.6.70.4270.04020.39
5.5.290.0030.05017.97
5.5.280.0000.04320.74
5.5.270.0000.09020.76
5.5.260.0100.07720.87
5.5.250.0270.06720.65
5.5.240.0200.07720.16
5.4.450.0830.06019.70
5.4.440.0700.06319.61
5.4.430.0830.06319.38
5.4.420.0870.06719.58
5.4.410.0970.07019.32
5.4.400.0800.05319.13
5.4.390.0970.04019.09
5.4.380.0870.05718.88
5.4.370.0670.04719.23
5.4.360.0730.05318.84
5.4.350.0630.05719.12
5.4.340.0800.03719.26
5.4.320.0570.06019.28
5.4.310.0570.05318.86
5.4.300.0700.05019.09
5.4.290.0670.05319.25
5.4.280.0730.05318.83
5.4.270.0800.04319.05
5.4.260.0800.05719.06
5.4.250.0770.05319.11
5.4.240.0770.05019.28
5.4.230.0870.04718.84
5.4.220.0730.06019.27
5.4.210.0800.05319.05
5.4.200.0770.04716.94
5.4.190.0870.05019.09
5.4.180.0800.05319.16
5.4.170.0800.05719.09
5.4.160.1030.07019.01
5.4.150.0630.06319.00
5.4.140.0670.06016.63
5.4.130.0830.04716.55
5.4.120.0700.05316.38
5.4.110.0870.06716.55
5.4.100.0730.06316.35
5.4.90.0830.06016.39
5.4.80.0930.04316.47
5.4.70.0800.04716.37
5.4.60.0030.07016.25
5.4.50.0100.03716.38
5.4.40.0230.06716.38
5.4.30.0300.07016.25
5.4.20.0270.04316.53

preferences:
141.79 ms | 1394 KiB | 7 Q