Part on Validator Class finished and Part 2 finished
This commit is contained in:
parent
ef90228439
commit
20aee0812f
2 changed files with 17 additions and 5 deletions
14
Validator.php
Normal file
14
Validator.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
class Validator
|
||||
{
|
||||
public static function string($value, $min = 1, $max = INF)
|
||||
{
|
||||
$value = trim($value);
|
||||
return strlen($value) >= $min && strlen($value) <= $max;
|
||||
}
|
||||
public static function email($value)
|
||||
{
|
||||
return filter_var($value, FILTER_VALIDATE_EMAIL);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue