3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Validate { public static $_Exceptions; public static function Run($o) { if($o->_HtmlOut == true) { $o->HtmlOutput(false); $Was_Html = true; } try { if(!is_array($o->_Fields)) throw new Exception("Os campos ainda não foram definidos."); foreach($o->_Fields as $Field) { if(is_empty($o->{$Field}) && in_array($Field, $o->_NotNull)); throw new Exception("O campo ". $Field ." da tabela ". $o->_Table ." não pode ser vazio."); switch(strtolower($o->_Meta[$Field])) { case('date') : if(!self::Date($o->{$Field}, Format::DATE)) self::$Errors[] = $Field; break; case('datetime') : if(!self::Date($o->{$Field}, Format::DATETIME)) self::$Errors[] = $Field; break; case('string') : if(!is_string($o->{$Field})) self::$Errors[] = $Field; break; case('int') : if(!is_int($o->{$Field})) if((int)($o->{$Field}) == $o->{$Field}) self::$Errors[] = $Field; break; } } } catch(Exception $e) { throw $e; } finally { if($Was_Html == true) $o->HtmlOutput(false); } if(is_array($Errors)) foreach($Errors as $Field) self::$_Exceptions[] = "Valor '". $o->{$Field} ."' para o campo ". $Field ."(".$o->_Meta[$Field].") da tabela ". $o->_Table ." é inválido"; self::_Throw(); return true; } public static function Date($data, Validate $type) { switch($type) { case(self::DATE) : if (date(DATE, strtotime($data)) == $data) return true; break; case(self::DATE_TIME) : if (date(DATE, strtotime($data)) == $data) return true; break; } return false; } public static function _Throw() { if (!is_array(self::$_Exceptions)) return false; $Exception = implode('<br />', self::$_Exceptions); unset(self::$_Exceptions); throw new Exception($Exception); } } ?>

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.70.0160.00616.38
8.3.60.0090.00618.38
8.3.50.0110.01316.45
8.3.40.0120.00318.68
8.3.30.0060.00918.56
8.3.20.0030.00618.49
8.3.10.0080.00018.47
8.3.00.0000.00819.23
8.2.180.0190.00016.75
8.2.170.0150.00022.96
8.2.160.0030.01318.47
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00421.09
8.2.110.0030.00622.08
8.2.100.0090.00319.21
8.2.90.0000.00917.50
8.2.80.0080.00017.97
8.2.70.0040.00417.50
8.2.60.0030.00617.93
8.2.50.0080.00018.07
8.2.40.0060.00319.22
8.2.30.0000.00917.61
8.2.20.0060.00317.45
8.2.10.0080.00019.34
8.2.00.0080.00017.48
8.1.280.0040.01125.92
8.1.270.0080.00023.99
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00422.39
8.1.230.0040.00718.98
8.1.220.0000.00917.74
8.1.210.0030.00618.77
8.1.200.0000.01217.09
8.1.190.0000.00817.11
8.1.180.0030.00618.10
8.1.170.0050.00318.82
8.1.160.0040.00418.99
8.1.150.0030.00518.45
8.1.140.0000.00817.33
8.1.130.0030.00317.35
8.1.120.0050.00217.29
8.1.110.0040.00417.43
8.1.100.0000.00717.39
8.1.90.0080.00017.41
8.1.80.0000.00717.39
8.1.70.0040.00417.28
8.1.60.0080.00017.51
8.1.50.0080.00017.37
8.1.40.0030.00517.36
8.1.30.0000.00817.42
8.1.20.0030.00517.62
8.1.10.0040.00417.41
8.1.00.0070.00017.39
8.0.300.0040.00421.45
8.0.290.0080.00016.75
8.0.280.0090.00018.63
8.0.270.0030.00317.21
8.0.260.0000.00716.67
8.0.250.0040.00416.82
8.0.240.0000.00916.85
8.0.230.0040.00416.75
8.0.220.0040.00416.70
8.0.210.0070.00016.79
8.0.200.0070.00016.75
8.0.190.0000.00816.83
8.0.180.0000.00816.74
8.0.170.0060.00316.81
8.0.160.0040.00416.83
8.0.150.0040.00416.66
8.0.140.0000.00816.82
8.0.130.0050.00013.23
8.0.120.0000.00816.67
8.0.110.0080.00016.80
8.0.100.0040.00416.79
8.0.90.0050.00216.88
8.0.80.0040.01116.77
8.0.70.0070.00016.75
8.0.60.0000.00916.79
8.0.50.0040.00416.79
8.0.30.0130.00417.20
8.0.20.0150.00616.89
8.0.10.0040.00416.85
8.0.00.0070.01516.58
7.4.330.0030.00312.94
7.4.320.0060.00316.48
7.4.300.0060.00016.41
7.4.290.0060.00316.56
7.4.280.0040.00416.49
7.4.270.0030.00916.38
7.4.260.0060.00013.12
7.4.250.0000.00816.44
7.4.240.0070.00016.45
7.4.230.0040.00416.26
7.4.220.0140.00416.37
7.4.210.0090.00716.59
7.4.200.0000.00716.26
7.4.190.0000.00716.33
7.4.160.0040.01216.50
7.4.150.0090.00916.13
7.4.140.0130.01317.86
7.4.130.0070.01016.53
7.4.120.0080.00916.58
7.4.110.0110.00716.33
7.4.100.0060.01116.46
7.4.90.0110.00716.42
7.4.80.0130.00619.39
7.4.70.0030.01316.36
7.4.60.0070.01016.46
7.4.50.0000.00516.13
7.4.40.0110.00816.50
7.4.30.0090.00716.33
7.4.00.0000.01615.06
7.3.330.0030.00513.25
7.3.320.0000.00613.01
7.3.310.0080.00016.12
7.3.300.0030.00316.06
7.3.290.0060.00916.22
7.3.280.0040.01216.18
7.3.270.0140.00416.32
7.3.260.0140.00516.49
7.3.240.0180.00616.40
7.3.230.0090.00616.26
7.3.210.0090.00916.23
7.3.200.0140.00316.38
7.3.190.0030.01416.25
7.3.180.0040.01216.10
7.3.170.0110.00816.34
7.3.160.0070.00716.46
7.3.120.0000.01314.86
7.2.330.0100.00716.27
7.2.320.0040.01216.30
7.2.310.0080.01416.41
7.2.300.0150.02716.39
7.2.290.0070.01016.33
7.2.60.0040.01116.59
7.2.00.0030.01019.13
7.1.200.0070.00315.34
7.1.100.0040.00717.39
7.1.70.0160.00316.89
7.1.60.0090.01619.25
7.1.50.0250.01434.57
7.1.00.0070.03022.31
7.0.200.0000.00916.75
7.0.140.0000.07722.00
7.0.120.0030.05722.18
7.0.80.0200.05020.05
7.0.70.0070.04720.05
7.0.60.0170.07319.82
7.0.50.0130.09020.38
7.0.40.0130.05720.14
7.0.30.0170.07720.09
7.0.20.0070.06019.99
7.0.10.0030.09320.09
7.0.00.0030.09020.18
5.6.280.0030.07321.02
5.6.230.0030.08320.70
5.6.220.0000.05020.49
5.6.210.0130.08320.59
5.6.200.0070.08721.13
5.6.190.0070.06721.01
5.6.180.0130.05020.93
5.6.170.0070.05321.13
5.6.160.0000.06020.97
5.6.150.0070.09021.04
5.6.140.0200.07321.12
5.6.130.0070.07321.09
5.6.120.0130.05721.12
5.6.110.0070.06021.03
5.6.100.0070.06321.17
5.6.90.0070.09021.02
5.6.80.0100.07720.42
5.6.70.0100.06720.50
5.6.60.0000.06020.40
5.6.50.0200.06720.48
5.6.40.0070.08020.38
5.6.30.0070.07320.39
5.6.20.0070.08020.45
5.6.10.0130.07720.41
5.6.00.0170.07020.39
5.5.370.0070.08320.37
5.5.360.0000.06020.48
5.5.350.0230.05720.46
5.5.340.0000.09020.95
5.5.330.0100.05720.82
5.5.320.0170.08020.80
5.5.310.0030.08320.92
5.5.300.0170.07020.92
5.5.290.0100.07320.86
5.5.280.0170.08320.66
5.5.270.0100.06320.87
5.5.260.0100.05720.87
5.5.250.0000.05320.71
5.5.240.0070.04320.32
5.5.230.0130.07020.23
5.5.220.0130.06720.13
5.5.210.0100.07720.29
5.5.200.0030.06320.30
5.5.190.0170.07320.27
5.5.180.0030.04720.25
5.5.160.0030.07720.25
5.5.150.0030.08320.19
5.5.140.0130.05720.20
5.5.130.0070.08320.30
5.5.120.0030.05720.30
5.5.110.0100.05320.22
5.5.100.0200.05720.18
5.5.90.0030.08320.14
5.5.80.0170.07020.11
5.5.70.0100.07320.17
5.5.60.0200.06720.11
5.5.50.0100.07719.96
5.5.40.0070.08320.13
5.5.30.0070.05020.06
5.5.20.0070.04020.07
5.5.10.0100.06720.04
5.5.00.0100.07720.05
5.4.450.0070.04719.46
5.4.440.0130.05019.46
5.4.430.0100.07319.50
5.4.420.0100.06319.41
5.4.410.0130.07019.36
5.4.400.0030.06719.09
5.4.390.0230.04319.14
5.4.380.0200.04719.03
5.4.370.0000.04719.13
5.4.360.0100.05319.09
5.4.350.0030.05319.03
5.4.340.0000.05018.88
5.4.320.0100.05719.08
5.4.310.0070.07719.09
5.4.300.0130.06318.84
5.4.290.0130.07319.06
5.4.280.0070.05318.90
5.4.270.0100.06018.88
5.4.260.0100.07018.85
5.4.250.0070.04319.04
5.4.240.0070.05719.13
5.4.230.0130.06319.17
5.4.220.0030.04318.84
5.4.210.0130.07319.09
5.4.200.0100.07319.08
5.4.190.0070.06319.03
5.4.180.0000.06319.13
5.4.170.0030.05719.07
5.4.160.0070.07719.18
5.4.150.0130.06319.21
5.4.140.0100.04016.36
5.4.130.0030.05716.34
5.4.120.0070.07016.42
5.4.110.0000.04016.39
5.4.100.0030.08716.41
5.4.90.0070.06316.51
5.4.80.0100.06716.31
5.4.70.0100.06016.49
5.4.60.0170.07016.45
5.4.50.0070.04316.26
5.4.40.0070.08016.46
5.4.30.0130.07316.30
5.4.20.0070.04016.44
5.4.10.0000.04716.44
5.4.00.0130.05015.85
5.3.290.0000.05014.78
5.3.280.0100.08014.76
5.3.270.0030.06014.73
5.3.260.0070.08014.68
5.3.250.0100.05714.68
5.3.240.0100.07714.59
5.3.230.0130.04014.63
5.3.220.0030.04714.68
5.3.210.0070.03714.64
5.3.200.0070.07714.65
5.3.190.0100.06714.61
5.3.180.0000.04314.65
5.3.170.0030.07314.63
5.3.160.0000.05314.55
5.3.150.0000.06314.54
5.3.140.0000.08014.67
5.3.130.0030.06314.68
5.3.120.0030.07714.66
5.3.110.0070.06314.60
5.3.100.0030.06314.08
5.3.90.0070.05314.18
5.3.80.0070.07314.06
5.3.70.0070.05014.10
5.3.60.0030.08014.12
5.3.50.0000.05714.03
5.3.40.0030.04313.87
5.3.30.0070.07313.90
5.3.20.0030.07713.77
5.3.10.0130.06313.75
5.3.00.0100.05313.77
5.2.170.0000.04011.06
5.2.160.0070.05311.02
5.2.150.0100.03311.07
5.2.140.0130.05711.06
5.2.130.0030.04311.04
5.2.120.0030.03710.98
5.2.110.0100.05711.04
5.2.100.0100.05711.12
5.2.90.0100.04711.02
5.2.80.0070.06711.06
5.2.70.0030.06311.00
5.2.60.0100.06011.18
5.2.50.0000.07011.11
5.2.40.0100.05711.13
5.2.30.0100.06011.02
5.2.20.0070.06010.93
5.2.10.0030.06310.87
5.2.00.0100.06010.88
5.1.60.0070.04710.12
5.1.50.0070.04010.09
5.1.40.0070.0509.85
5.1.30.0030.05710.29
5.1.20.0000.05710.51
5.1.10.0070.05310.18
5.1.00.0030.05710.16
5.0.50.0000.0338.66
5.0.40.0030.0338.28
5.0.30.0030.0438.25
5.0.20.0000.0238.23
5.0.10.0100.0408.28
5.0.00.0070.0478.00
4.4.90.0030.0337.22
4.4.80.0030.0277.22
4.4.70.0000.0307.22
4.4.60.0030.0277.22
4.4.50.0000.0277.22
4.4.40.0070.0277.22
4.4.30.0000.0377.22
4.4.20.0000.0207.22
4.4.10.0000.0437.22
4.4.00.0230.0307.22
4.3.110.0000.0307.22
4.3.100.0000.0237.22
4.3.90.0030.0337.22
4.3.80.0100.0477.22
4.3.70.0030.0337.22
4.3.60.0000.0307.22
4.3.50.0130.0277.22
4.3.40.0030.0507.22
4.3.30.0030.0277.22
4.3.20.0030.0377.22
4.3.10.0030.0237.22
4.3.00.0000.0207.22

preferences:
55.08 ms | 401 KiB | 5 Q