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"; 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() { $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)
5.4.240.0070.05019.16
5.4.230.0070.05019.14
5.4.220.0100.04319.23
5.4.210.0070.07018.87
5.4.200.0000.04719.11
5.4.190.0070.07718.84
5.4.180.0100.07719.07
5.4.170.0130.07019.23
5.4.160.0070.05319.05
5.4.150.0130.07018.84
5.4.140.0100.07016.40
5.4.130.0070.05016.39
5.4.120.0030.06016.44
5.4.110.0000.04716.43
5.4.100.0130.06716.45
5.4.90.0100.04316.42
5.4.80.0070.06716.37
5.4.70.0070.06716.46
5.4.60.0000.05316.66
5.4.50.0070.08016.45
5.4.40.0030.04716.43
5.4.30.0070.03716.36
5.4.20.0070.04716.27
5.4.10.0100.07016.44
5.4.00.0070.07315.78
5.3.280.0030.05314.50
5.3.270.0100.07014.63
5.3.260.0030.06014.68
5.3.250.0100.07014.68
5.3.240.0030.05314.63
5.3.230.0000.08714.54
5.3.220.0070.07714.61
5.3.210.0030.06014.59
5.3.200.0000.08014.62
5.3.190.0170.05314.58
5.3.180.0070.03714.49
5.3.170.0170.06314.58
5.3.160.0100.06714.63
5.3.150.0070.05314.74
5.3.140.0030.05014.46
5.3.130.0100.07714.71
5.3.120.0070.07714.61
5.3.110.0130.06314.57
5.3.100.0030.07314.13
5.3.90.0000.08014.11
5.3.80.0100.07014.02
5.3.70.0030.06713.95
5.3.60.0030.07714.02
5.3.50.0030.08014.00
5.3.40.0070.07014.13
5.3.30.0070.07313.88
5.3.20.0070.07313.76
5.3.10.0030.04013.71
5.3.00.0100.05713.82

preferences:
143.84 ms | 1394 KiB | 7 Q